Skip to content

Commit

Permalink
Added logging for mediarecorder intervals, and changed start value
Browse files Browse the repository at this point in the history
  • Loading branch information
samdutton committed Jul 11, 2023
1 parent cc16fbe commit 56c5ac7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mediarecorder/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ function handleSourceOpen(event) {
console.log('Source buffer: ', sourceBuffer);
}

let previousTime = Date.now();

function handleDataAvailable(event) {
const timeNow = Date.now();
console.log(`Interval: ${timeNow - previousTime}`);
previousTime = timeNow;
if (event.data && event.data.size > 0) {
recordedBlobs.push(event.data);
}
Expand Down Expand Up @@ -123,7 +128,7 @@ function startRecording() {
downloadButton.disabled = true;
mediaRecorder.onstop = handleStop;
mediaRecorder.ondataavailable = handleDataAvailable;
mediaRecorder.start(10); // collect 10ms of data
mediaRecorder.start(1000); // collect 10ms of data
console.log('MediaRecorder started', mediaRecorder);
}

Expand Down

0 comments on commit 56c5ac7

Please sign in to comment.