change xhr handler

This commit is contained in:
Roy Olav Purser 2021-05-12 10:46:10 +02:00
parent 46950eb6d0
commit 7f380b4da5
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

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