8: 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
59
60
61
62
<!-- 
  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/api/v11/js/cameratag.min.js' type='text/javascript'></script>
    <script src='https://code.jquery.com/jquery-2.1.4.min.js' type='text/javascript'></script>
    <link rel='stylesheet' href='//www.cameratag.com/static/11/cameratag.css'></link>
    
    <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'></camera>

    <div id="DemoCamera-start-screen" class="cameratag_screen cameratag_start" style="position: absolute; display: none;">
        <div id="step1">
            <a class="cameratag_select_prompt">Enter your email to submit a video</a>
            <input id="email" type="email" style="width:50%; padding:10px; border:0px; margin-top:15px; font-size:12px;">
            <div id="submit" style="font-size:12px; display:inline-block; padding:10px 25px; vertical-align: middle; background:#C5114D; color:#fff; cursor:pointer;">Next</div>
        </div>

        <div id="step2" style="display:none">
            <a class="cameratag_select_prompt">Select a method below to submit your video</a>

            <a class="cameratag_primary_link cameratag_record_link cameratag_record"><span class="cameratag_action_icon"><i class="fa fa-video-camera" aria-hidden="true"></i></span><br><span class="cameratag_prompt_label">Webcam</span></a>
            
            <a id="'+dom_id+'_upload_link" class="cameratag_primary_link cameratag_upload_link cameratag_upload"><span class="cameratag_action_icon">&#61678;</span><br><span class="cameratag_prompt_label">Upload</span></a>

            <a class="cameratag_primary_link cameratag_sms_link cameratag_sms"><span class="cameratag_action_icon">&#61707;</span><br><span class="cameratag_prompt_label">Record by Phone</span></a>

            <i class="cameratag_settings_btn fa fa-cog" src="//cameratag.com/assets/gear.png"></i>
        </div>
    </div>
  </body>
</html>