add video tag from js
This commit is contained in:
parent
8efc686f83
commit
8fbf8a4f62
@ -5,6 +5,5 @@
|
||||
<script src="{{ script }}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<video class="video-js" id="player" controls></video>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,8 +1,13 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
let bodies = document.getElementsByTagName("body");
|
||||
if(bodies.length === 1) {
|
||||
let body = bodies[0];
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = () => {
|
||||
let video = document.createElement("video");
|
||||
body.appendChild(video);
|
||||
let ctype = xhr.getResponseHeader("Content-Type");
|
||||
let player = videojs("player");
|
||||
let player = videojs(video);
|
||||
let source = {};
|
||||
source.type = ctype;
|
||||
source.src = "{{ stream }}";
|
||||
@ -10,4 +15,5 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
xhr.open("HEAD", "{{ stream }}", true);
|
||||
xhr.send();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user