Code Examples
user data entry
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <!--
This example uses a few CameraTag features. First it uses our customizable
HTML interface to create a custom start screen that requests an email
address from the user. If the user enters a valid email adddress it will
attach the email address as metadata on the video and allow the user to
record / upload a video. Note- we intentioanlly left any styling out of
the xample to keep the code as simple as possible :)
-->
<html>
<head>
<script src='//www.cameratag.com/v15/js/cameratag.min.js' type='text/javascript'></script>
<link rel='stylesheet' href='//www.cameratag.com/v15/css/cameratag.css'></link>
<script src='https://code.jquery.com/jquery-2.1.4.min.js' type='text/javascript'></script>
<script>
$(function(){
$("#submit").click(function(){
var user_email = $("#email").val();
if (validateEmail(user_email)) {
CameraTag.cameras["DemoCamera"].setMetadata({
email: user_email
})
$("#step1").hide();
$("#step2").show();
} else {
alert("that is not an email");
}
})
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
})
</script>
</head>
<body>
<camera id='DemoCamera' data-app-id='63f9c870-72c4-0130-04c5-123139045d73'>
<div class="start-screen">
<div id="step1">
What is your email address?<br/>
<input id="email" type="email">
<button id="submit">Next</button>
</div>
<div id="step2" style="display:none">
<a class="cameratag_record">record from webcam</a>
<br/>
<a class="cameratag_upload">upload</a>
</div>
</div>
</camera>
</body>
</html>
|