Browse Source

FInalized screen capture function

tobychui 3 years ago
parent
commit
51081be7cf
1 changed files with 19 additions and 4 deletions
  1. 19 4
      web/Recorder/index.html

+ 19 - 4
web/Recorder/index.html

@@ -27,6 +27,10 @@
             .uitab{
                 border: 0px solid transparent !important;
             }
+
+            .tab.disabled{
+                opacity: 0.5;
+            }
         </style>
     </head>
     <body>
@@ -65,6 +69,7 @@
                 <br>
                 <small>Notes: This function require websocket upload to be enabled.</small>
                 <br>
+                <!--
                 <div class="ui selection fluid dropdown" style="margin-top: 0.4em;">
                     <input type="hidden" name="format" id="captureFormat" value="video/webm">
                     <i class="dropdown icon"></i>
@@ -74,6 +79,7 @@
                         <div class="item" data-value="video/mp4">mp4 (H264)</div>
                     </div>
                 </div>
+            -->
                 
             </div>
             <div id="settingTab" class="ui bottom attached basic segment uitab" style="display:none; margin-bottom: 0px;">
@@ -111,6 +117,9 @@
             createSaveDirIfNotExists();
             
             function opentab(tabName, object){
+                if ($(object).hasClass('disabled')){
+                    return;
+                }
                 $(".uitab").hide();
                 $(".active.tab").removeClass("active");
                 if (tabName == "audio"){
@@ -138,6 +147,7 @@
                 $("#record").addClass("disabled");
                 $("#stop").removeClass("disabled");
                 updateStatus("Recording Started");
+                $(".item.tab").addClass("disabled");
                 recordCounter = 0;
                 recordTimer = setInterval(function(){
                     recordCounter++;
@@ -150,7 +160,8 @@
                 $("#record").removeClass("disabled");
                 $("#stop").addClass("disabled");
                 clearInterval(recordTimer);
-                updateStatus("Recording Stopped")
+                updateStatus("Recording Stopped");
+                $(".item.tab").removeClass("disabled");
                 renderWAV(function(blob){
                     //Process the blob data here
                     updateStatus("Saving")
@@ -305,7 +316,7 @@
             }
 
             function getVideoFilename(){
-                var fileName = new Date().toLocaleDateString().split("/").join("-") + "_" +  new Date().toLocaleTimeString(undefined, {hour12: false}).split(":").join("-") + ".webm"
+                var fileName = new Date().toLocaleDateString().split("/").join("-") + "_" +  new Date().toLocaleTimeString(undefined, {hour12: false}).split(":").join("-") + ".webm";
                 return fileName;
             }
 
@@ -344,6 +355,7 @@
                 videCaptureRecorder.camera.stop();
                 videCaptureRecorder = null;
             }
+          
 
             function startVideoCapture() {
                 this.disabled = true;
@@ -354,7 +366,7 @@
 
                     videCaptureRecorder = RecordRTC(camera, {
                         recorderType: MediaStreamRecorder,
-                        mimeType: 'video/webm',
+                        mimeType: "video/webm",
                         timeSlice: 100,
                         getNativeBlob: true,
                         ondataavailable: function(blob) {
@@ -366,11 +378,13 @@
 
                     // release camera on stopRecording
                     videCaptureRecorder.camera = camera;
+                    recordCounter=0;
                     recordTimer = setInterval(function(){
                         recordCounter++;
                         updateStatus("Capturing T: " + secondsToHms(recordCounter))
                     }, 1000);
 
+                    $(".item.tab").addClass("disabled");
                     $("#capture").addClass("disabled");
                     $("#vidstop").removeClass("disabled");
                 });
@@ -381,7 +395,8 @@
                 videCaptureRecorder.stopRecording(stopRecordingCallback);
                 websocket.send("done");
                 clearInterval(recordTimer);
-                updateStatus("Capturing Stopped")
+                updateStatus("Capturing Stopped");
+                $(".item.tab").removeClass("disabled");
                 $("#vidstop").addClass("disabled");
                 $("#capture").removeClass("disabled");
             }