blob: 5beefdad526172e617065f62cb9abee42b74377f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import HLS from "npm:hls.js";
export default function execFor(id, path) {
const video = document.getElementById(id);
if (HLS.isSupported()) {
const hls = new HLS();
hls.loadSource(path);
hls.attachMedia(video);
hls.on(HLS.Events.MANIFEST_PARSED, function () {
video.play();
});
} else if (video.canPlayType("application/vnd.apple.mpegurl")) {
video.src = path;
video.addEventListener("loadedmetadata", function () {
video.play();
});
}
}
|