test
This commit is contained in:
parent
66ba1f11ef
commit
ceab95b00e
40
reader/html/html.html
Normal file
40
reader/html/html.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" name="viewport" content="width=device-width">
|
||||
<title>HLS STREAMING TEST PAGE</title>
|
||||
<script src='https://cdn.jsdelivr.net/npm/hls.js@latest'></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function load(src) {
|
||||
for (let i = 0; i < src.length; i++) {
|
||||
if (Hls.isSupported()){
|
||||
let elem = document.createElement('video');
|
||||
const hls = new Hls();
|
||||
elem.id = 'video' + i;
|
||||
elem.style = "height: 320px; width: 480px";
|
||||
elem.autoplay = true;
|
||||
elem.muted = true;
|
||||
elem.controls = true;
|
||||
elem.preload = "metadata";
|
||||
|
||||
document.body.append(elem);
|
||||
hls.loadSource(src[i]);
|
||||
hls.attachMedia(elem);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||||
setTimeout(()=> {
|
||||
elem.play();
|
||||
},2000)
|
||||
});
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = src[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
const scrArr = ["http://localhost:8080/data/Master.m3u8"]
|
||||
|
||||
load(scrArr)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user