heading-ears/archive/radio_heeju.html
2024-10-12 15:28:34 +09:00

45 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="js//hls.min.js" crossorigin="anonymous"></script>
<title>Radio</title>
</head>
<body>
<video id="video" controls></video>
<script>
var video = document.getElementById('video');
if (Hls.isSupported()) {
var hls = new Hls({
debug: true,
// html5: { nativeAudioTracks: false }
});
hls.loadSource('https://radio.ururu.cloud/hls/live.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MEDIA_ATTACHED, function () {
video.muted = true;
video.play();
});
}
// hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
// When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element through the `src` property.
// This is using the built-in support of the plain video element, without using hls.js.
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = 'https://radio.ururu.cloud/hls/live.m3u8';
video.addEventListener('canplay', function () {
video.play();
});
}
</script>
</body>
</html>