Skip to content

Commit 56c5ac7

Browse files
committed
Added logging for mediarecorder intervals, and changed start value
1 parent cc16fbe commit 56c5ac7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mediarecorder/js/main.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ function handleSourceOpen(event) {
7373
console.log('Source buffer: ', sourceBuffer);
7474
}
7575

76+
let previousTime = Date.now();
77+
7678
function handleDataAvailable(event) {
79+
const timeNow = Date.now();
80+
console.log(`Interval: ${timeNow - previousTime}`);
81+
previousTime = timeNow;
7782
if (event.data && event.data.size > 0) {
7883
recordedBlobs.push(event.data);
7984
}
@@ -123,7 +128,7 @@ function startRecording() {
123128
downloadButton.disabled = true;
124129
mediaRecorder.onstop = handleStop;
125130
mediaRecorder.ondataavailable = handleDataAvailable;
126-
mediaRecorder.start(10); // collect 10ms of data
131+
mediaRecorder.start(1000); // collect 10ms of data
127132
console.log('MediaRecorder started', mediaRecorder);
128133
}
129134

0 commit comments

Comments
 (0)