stream-api/index.html

24 lines
845 B
HTML
Raw Normal View History

2021-05-09 16:43:28 +00:00
<html>
<head>
2021-05-10 15:40:38 +00:00
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video-js.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video.min.js"></script>
2021-05-09 16:43:28 +00:00
</head>
<body>
2021-05-12 07:28:09 +00:00
<video class="video-js" id="player" controls>
2021-05-09 16:43:28 +00:00
</video>
2021-05-12 07:28:09 +00:00
<script>
let xhr = new XmlHttpRequest();
xhr.onreadystatechange = () => {
let ctype = xhr.getResponseHeader("Content-Type");
let player = videojs("player");
let source = {};
source.type = ctype;
source.src = {{ stream }};
player.src(source);
}
xhr.open("HEAD", {{ stream }}, true);
xhr.send();
</script>
2021-05-09 16:43:28 +00:00
</body>
</html>