mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 10:53:50 +02:00
Add Matroska demuxer
This commit is contained in:
+17
-2
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<input type="file" accept="video/mp4,video/quicktime,audio/x-m4a,video/x-m4v,audio/wav">
|
||||
<input type="file" accept="video/mp4,video/quicktime,audio/x-m4a,video/x-m4v,audio/wav,video/webm">
|
||||
|
||||
<div id="player"
|
||||
style="display: none; flex-direction: column; align-items: center;
|
||||
@@ -35,6 +35,7 @@ fileInput.style.display = 'none';
|
||||
const audioContext = new AudioContext();
|
||||
|
||||
const source = new Metamuxer.BlobSource(file);
|
||||
|
||||
const input = new Metamuxer.Input({
|
||||
formats: Metamuxer.ALL_FORMATS,
|
||||
source
|
||||
@@ -43,7 +44,21 @@ const input = new Metamuxer.Input({
|
||||
console.log(await input.getMimeType())
|
||||
|
||||
let videoTrack = await input.getPrimaryVideoTrack();
|
||||
let audioTrack = await input.getPrimaryAudioTrack();
|
||||
let audioTrack = await input.getPrimaryAudioTrack();
|
||||
|
||||
//console.log(await videoTrack.computeDuration());
|
||||
//await new Promise(() => {});
|
||||
|
||||
/*
|
||||
const sink = new Metamuxer.EncodedVideoSampleSink(videoTrack);
|
||||
|
||||
for await (const sample of sink.samples()) {
|
||||
console.log(sample);
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
await new Promise(() => {});
|
||||
*/
|
||||
|
||||
if (!(await videoTrack?.canDecode())) {
|
||||
videoTrack = null;
|
||||
|
||||
Reference in New Issue
Block a user