mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-30 20:33:55 +02:00
WIP
This commit is contained in:
+57
-1
@@ -14,7 +14,61 @@
|
||||
source: new Mediabunny.BlobSource(file),
|
||||
});
|
||||
|
||||
console.log(await input.getTracks());
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
const cursor = await Mediabunny.VideoSampleCursor2.init(videoTrack);
|
||||
|
||||
/*
|
||||
console.log(await cursor.seekTo(2.00));
|
||||
console.log(await cursor.next());
|
||||
console.log(await cursor.next());
|
||||
*/
|
||||
|
||||
const mh = [
|
||||
cursor.seekTo(2.10),
|
||||
cursor.seekTo(5),
|
||||
//cursor.seekTo(2.00),
|
||||
];
|
||||
|
||||
console.log(await Promise.all(mh));
|
||||
|
||||
//console.log(await cursor.seekTo(2.05));
|
||||
//console.log(await cursor.seekTo(2.10));
|
||||
//console.log(await cursor.seekTo(10.2));
|
||||
//console.log(await cursor.seekTo(5.2));
|
||||
|
||||
/*
|
||||
setTimeout(async () => {
|
||||
console.log("this")
|
||||
|
||||
}, 500);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
const iters = 5;
|
||||
let total = 0;
|
||||
|
||||
for (let i = 0; i < iters; i++) {
|
||||
const file = fileInput.files[0];
|
||||
const input = new Mediabunny.Input({
|
||||
formats: Mediabunny.ALL_FORMATS,
|
||||
source: new Mediabunny.BufferSource(await file.arrayBuffer()),
|
||||
});
|
||||
|
||||
const audioTrack = await input.getPrimaryAudioTrack();
|
||||
const cursor = new Mediabunny.PacketCursor(audioTrack);
|
||||
|
||||
await cursor.seekToStart();
|
||||
|
||||
const start = performance.now();
|
||||
await cursor.iterate(() => {});
|
||||
//alert(performance.now() - start)
|
||||
|
||||
total += performance.now() - start;
|
||||
}
|
||||
|
||||
alert(total / iters);
|
||||
*/
|
||||
|
||||
/*
|
||||
return;
|
||||
@@ -95,6 +149,8 @@
|
||||
total += end - start;
|
||||
//console.log(total / file.size, end - start);
|
||||
}
|
||||
alert(elapsed / iters);
|
||||
|
||||
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
const sink = new Mediabunny.EncodedPacketSink(videoTrack);
|
||||
|
||||
Reference in New Issue
Block a user