-
Notifications
You must be signed in to change notification settings - Fork 36
/
demux-ts.html
66 lines (55 loc) · 1.7 KB
/
demux-ts.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
60
61
62
63
64
65
66
<!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.ts.umd.js"></script>
<script>
const TSDemux = Demuxer.TSDemux;
const Events = Demuxer.Events;
</script>
-->
<script type="module">
// ES Module import
// import { TSDemux, Events } from '../../dist/demuxer.ts.esm.js';
import { TSDemux, Events } from '../../dist/demuxer.all.esm.js';
let tsUrl = './1718677128314-48.ts';
fetch(tsUrl).then((res) => {
res.arrayBuffer().then((bytes) => {
let demux = new TSDemux({
debug: true, // if env is production, debug should be false or not specified.
decodeCodec: true
});
demux.on(Events.DEMUX_DATA, (e) => {
console.log(e);
// if (e.stream_type === 15) {
// console.log(e)
// }
});
demux.on(Events.DONE, (e) => {
// consumed & flushed all pipe buffer.
});
// buffer -> video bytes ArrayBuffer
demux.push(bytes, {
done: true
});
});
});
</script>
</head>
<body style="background-color: darkslategray;"></body>
</html>