You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RTSPtoWeb/docs/examples/hls/index.html

34 lines
988 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RTSPtoWeb HLS example</title>
</head>
<body>
<h1>RTSPtoWeb HLS example</h1>
<input type="hidden" name="hls-url" id="hls-url"
value="http://localhost:8083/stream/demo/channel/0/hls/live/index.m3u8">
<video id="hls-video" autoplay muted playsinline controls
style="max-width: 100%; max-height: 100%;"></video>
<script>
document.addEventListener('DOMContentLoaded', function () {
const videoEl = document.querySelector('#hls-video')
const hlsUrl = document.querySelector('#hls-url').value
if (Hls.isSupported()) {
const hls = new Hls()
hls.loadSource(hlsUrl)
hls.attachMedia(videoEl)
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
videoEl.src = hlsUrl
}
})
</script>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
</body>
</html>