mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Manually write the async generators so that return() is immediate
This commit is contained in:
+11
-4
@@ -5,6 +5,7 @@
|
||||
fileInput.type = 'file';
|
||||
document.body.append(fileInput);
|
||||
|
||||
/*
|
||||
const encoder = new AudioEncoder({
|
||||
output: console.log,
|
||||
error: console.error
|
||||
@@ -25,6 +26,7 @@
|
||||
numberOfFrames: 48000
|
||||
});
|
||||
encoder.encode(audioData);
|
||||
*/
|
||||
|
||||
fileInput.addEventListener('change', async () => {
|
||||
const file = fileInput.files[0];
|
||||
@@ -35,11 +37,16 @@
|
||||
});
|
||||
|
||||
const audioTrack = await input.getPrimaryAudioTrack();
|
||||
const drain = new Metamuxer.EncodedAudioChunkDrain(audioTrack);
|
||||
const drain = new Metamuxer.AudioBufferDrain(audioTrack);
|
||||
|
||||
for await (const chunk of drain.chunks()) {
|
||||
console.log(chunk)
|
||||
}
|
||||
const chunks = drain.buffers()
|
||||
const a = chunks.next();
|
||||
|
||||
//chunks.return();
|
||||
|
||||
console.log(await a)
|
||||
|
||||
//console.log("Done")
|
||||
|
||||
/*
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
|
||||
Reference in New Issue
Block a user