From 3ccbef047e866d1470b22a6fd3dad1d9cb52cfec Mon Sep 17 00:00:00 2001 From: Roy Olav Purser Date: Wed, 12 May 2021 10:53:33 +0200 Subject: [PATCH] print ctype --- script.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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(); } });