mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-12-24 12:57:56 +08:00
37 lines
994 B
HTML
37 lines
994 B
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>hls - go2rtc</title>
|
|
<style>
|
|
body {
|
|
background-color: black;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
html, body, video {
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@1"></script>
|
|
<video id="video" autoplay controls playsinline muted></video>
|
|
<script>
|
|
// http://192.168.1.123:1984/hls.html?src=demo&mp4
|
|
const url = new URL('api/stream.m3u8' + location.search, location.href);
|
|
|
|
const video = document.getElementById('video');
|
|
/* global Hls */
|
|
if (Hls.isSupported()) {
|
|
const hls = new Hls();
|
|
hls.loadSource(url.toString());
|
|
hls.attachMedia(video);
|
|
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
|
video.src = url.toString();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |