print ctype

This commit is contained in:
Roy Olav Purser 2021-05-12 10:53:33 +02:00
parent 7f380b4da5
commit 3ccbef047e
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -3,20 +3,21 @@ document.addEventListener("DOMContentLoaded", () => {
if(bodies.length === 1) { if(bodies.length === 1) {
let body = bodies[0]; let body = bodies[0];
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.addEventListener("load", (e) => { let upstream = "{{ stream }}";
console.log(e); xhr.addEventListener("load", () => {
let video = document.createElement("video"); let video = document.createElement("video");
video.id = "video-player"; video.id = "video-player";
video.className = "video-js"; video.className = "video-js";
body.appendChild(video); body.appendChild(video);
let ctype = xhr.getResponseHeader("Content-Type"); let ctype = xhr.getResponseHeader("Content-Type");
console.log(ctype);
let player = videojs("video-player"); let player = videojs("video-player");
let source = {}; let source = {};
source.type = ctype; source.type = ctype;
source.src = "{{ stream }}"; source.src = upstream;
player.src(source); player.src(source);
}); });
xhr.open("HEAD", "{{ stream }}", true); xhr.open("HEAD", upstream, true);
xhr.send(); xhr.send();
} }
}); });