stream-api/script.js

14 lines
415 B
JavaScript

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();
});