-
Notifications
You must be signed in to change notification settings - Fork 36
/
demux-mp4.html
59 lines (48 loc) · 1.56 KB
/
demux-mp4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Demuxer</title>
<style type="text/css">
body {
font: 12px/1.5 Tahoma, Helvetica, Arial, '\5FAE\8F6F\96C5\9ED1', sans-serif;
}
div {
outline: none;
}
video {
width: 100%;
height: 100%;
}
</style>
<!-- browser import -->
<!-- <script type="text/javascript" src="../../dist/demuxer.all.umd.js"></script>
<script>
const MP4Demux = Demuxer.MP4Demux;
const Events = Demuxer.Events;
</script> -->
<script type="module">
// ES Module import
import { MP4Demux, Events } from '../../dist/demuxer.mp4.esm.js';
// import { MP4Demux, Events } from '../../dist/demuxer.all.esm.js';
let tsUrl = './hdr420_480_30s.fmp4';
fetch(tsUrl).then((res) => {
res.arrayBuffer().then((bytes) => {
let demux = new MP4Demux({
debug: true // if env is production, debug should be false or not specified.
});
demux.on(Events.DEMUX_DATA, (e) => {
console.log(e);
});
demux.on(Events.DONE, (e) => {
// consumed & flushed all pipe buffer.
});
// buffer -> video bytes ArrayBuffer
demux.push(bytes);
});
});
</script>
</head>
<body style="background-color: darkslategray;"></body>
</html>