apifiber/index.html

30 lines
877 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>HLS.js Example</title>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
</head>
<body>
<video id="videoPlayer" controls autoplay></video>
<script>
if (Hls.isSupported()) {
var video = document.getElementById('videoPlayer');
var hls = new Hls();
hls.loadSource('http://localhost:8080/hls/teste/playlist.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
video.play();
});
}
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = 'http://localhost:8080/hls/teste/playlist.m3u8';
video.addEventListener('loadedmetadata', function () {
video.play();
});
}
</script>
</body>
</html>