Skip to content

Commit b26e9d7

Browse files
option to load from file
1 parent 2645bc7 commit b26e9d7

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

WebCodecs/decodeToVideo.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
const fileButton = document.querySelector("input");
2121
const video = document.querySelector('video');
2222

23+
// Assumes file has both audio and video tracks
2324
const videoTrackGenerator = new MediaStreamTrackGenerator({ kind: 'video' });
2425
const audioTrackGenerator = new MediaStreamTrackGenerator({ kind: 'audio' });
2526

WebCodecs/worker.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,8 @@ async function start(data) {
154154
}
155155

156156
// Wait until we have a queue of both audio and video samples before rendering
157-
// ToDo: Assumes there is both audio and video tracks otherwise it will never play
158157
function render() {
159-
if(rendering){
160-
// console.log("already rendering");
161-
return;
162-
}
163-
// start rendering once there is a queue of samples
164-
else if (videoSamples.length > 100 && audioSamples.length > 100) {
158+
if (!rendering && videoSamples.length > 100 && audioSamples.length > 100) {
165159
console.log("starting rendering");
166160
rendering = true;
167161
renderAudioLoop(); // this is about ~1 second behind the video

0 commit comments

Comments
 (0)