stream-api/script.js

14 lines
415 B
JavaScript
Raw Normal View History

2021-05-12 07:50:51 +00:00
document.addEventListener("DOMContentLoaded", () => {
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();
});