Browse Source

delay 2 secs

Davide Alberani 5 years ago
parent
commit
d4cd19cca4
2 changed files with 7 additions and 2 deletions
  1. 1 1
      static/index.html
  2. 6 1
      static/js/sb.js

+ 1 - 1
static/index.html

@@ -19,7 +19,7 @@
 
             <div id="button-containers" class="row">
                 <button id="take-photo-btn" class="btn waves-effect waves-light disabled" name="take-photo-btn" onClick="takePhoto()">
-                    <i class="material-icons left">camera</i>Take photo
+                    <i class="material-icons left">camera</i>Take photo <small>(2 secs delay)</small>
                 </button>
                 <button id="send-photo-btn" class="btn waves-effect waves-light disabled" name="send-photo-btn" onClick="sendPhoto()">
                     <i class="material-icons left">share</i>Share photo

+ 6 - 1
static/js/sb.js

@@ -143,7 +143,7 @@ function sendPhoto() {
 }
 
 
-function takePhoto() {
+function _takePhoto() {
     console.log("take photo");
     document.querySelector("#sb-message").style.visibility = "visible";
     var video = document.querySelector("#sb-video");
@@ -175,6 +175,11 @@ function takePhoto() {
 }
 
 
+function takePhoto() {
+    window.setTimeout(_takePhoto, 2000);
+}
+
+
 function initCamera() {
     console.log("request camera permission");
     document.querySelector("#canvas-container").style.display = "block";