From 7f380b4da5829f95b015195efc3356f66e913546 Mon Sep 17 00:00:00 2001 From: Roy Olav Purser Date: Wed, 12 May 2021 10:46:10 +0200 Subject: [PATCH] change xhr handler --- script.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 74cdd79..f7f8feb 100644 --- a/script.js +++ b/script.js @@ -3,7 +3,8 @@ document.addEventListener("DOMContentLoaded", () => { if(bodies.length === 1) { let body = bodies[0]; let xhr = new XMLHttpRequest(); - xhr.onreadystatechange = () => { + xhr.addEventListener("load", (e) => { + console.log(e); let video = document.createElement("video"); video.id = "video-player"; video.className = "video-js"; @@ -14,7 +15,7 @@ document.addEventListener("DOMContentLoaded", () => { source.type = ctype; source.src = "{{ stream }}"; player.src(source); - } + }); xhr.open("HEAD", "{{ stream }}", true); xhr.send(); }