diff --git a/samples/capture-to-file/capture-to-file.html b/samples/capture-to-file/capture-to-file.html index 2aa82b56..c6a9b055 100755 --- a/samples/capture-to-file/capture-to-file.html +++ b/samples/capture-to-file/capture-to-file.html @@ -98,10 +98,10 @@ encoder.configure(config); frameReader.read().then(function processFrame({done, value}) { - if(done) { - self.postMessage("Stream is done."); + if(done||stop) { value.close(); - frameReader.releaseLock(); + encoder.close(); + frame_counter = 0; return; } @@ -120,7 +120,7 @@ } async function main() { video = document.getElementById("src"); - let constraints = { audio: false, video: { width: 1280, height: 720, frameRate: 30 } }; + let constraints = { audio: false, video: {width: 1280, height: 720, frameRate: 30}}; stream = await window.navigator.mediaDevices.getUserMedia(constraints); video.srcObject = stream; } diff --git a/samples/capture-to-file/webm-writer2.js b/samples/capture-to-file/webm-writer2.js index ccf64a0b..ec127696 100755 --- a/samples/capture-to-file/webm-writer2.js +++ b/samples/capture-to-file/webm-writer2.js @@ -1116,6 +1116,7 @@ let WebMWriter = function(ArrayBufferDataStream, BlobBuffer) { addFrameToCluster({ frame: new Uint8Array(frame.data), intime: frame.timestamp, + type: frame.type, }); return; }