🎥 Make videos programmatically with React
fix getPartialAudioData was not resolving if parser reached the end of the track
Igor Samokhovetsa5878158b583
diff --git a/packages/webcodecs/src/get-partial-audio-data.ts b/packages/webcodecs/src/get-partial-audio-data.tsindex 3d5d67b03b..0982d52541 100644--- a/packages/webcodecs/src/get-partial-audio-data.ts+++ b/packages/webcodecs/src/get-partial-audio-data.ts@@ -193,6 +193,15 @@ export const getPartialAudioData = async ({await audioDecoder.waitForQueueToBeLessThan(10);// we're waiting for the queue above anyway, enqueue in sync modeaudioDecoder.decode(sample);++ // this is called on the last sample of the track+ // so if we have reached the end of the track, resolve the promise+ return () => {+ audioDecoder.flush().then(() => {+ audioDecoder.close();+ resolveAudioDecode();+ });+ };};},});