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