separate style file
This commit is contained in:
13
frontend/index.html
Normal file
13
frontend/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video-js.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@silvermine/videojs-chromecast@latest/dist/silvermine-videojs-chromecast.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@silvermine/videojs-chromecast@latest/dist/silvermine-videojs-chromecast.min.js"></script>
|
||||
<script src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"></script>
|
||||
<script src="{{ script }}"></script>
|
||||
<link rel="stylesheet" href="{{ custom_style }}">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
32
frontend/script.js
Normal file
32
frontend/script.js
Normal file
@ -0,0 +1,32 @@
|
||||
let url = new URL("{{ stream }}", window.location.origin);
|
||||
let upstream = url.href;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
let bodies = document.getElementsByTagName("body");
|
||||
if(bodies.length === 1) {
|
||||
let body = bodies[0];
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", () => {
|
||||
let video = document.createElement("video");
|
||||
video.className = "video-js vjs-big-play-centered";
|
||||
body.appendChild(video);
|
||||
let ctype = xhr.getResponseHeader("Content-Type");
|
||||
console.log(ctype);
|
||||
let options = {};
|
||||
options.controls = true;
|
||||
options.liveui = true;
|
||||
options.responsive = true;
|
||||
options.fill = true;
|
||||
options.techOrder = ["chromecast", "html5"];
|
||||
options.plugins = {};
|
||||
options.plugins.chromecast = {};
|
||||
let player = videojs(video, options);
|
||||
let source = {};
|
||||
source.type = ctype;
|
||||
source.src = upstream;
|
||||
player.src(source);
|
||||
});
|
||||
xhr.open("HEAD", upstream, true);
|
||||
xhr.send();
|
||||
}
|
||||
});
|
6
frontend/style.css
Normal file
6
frontend/style.css
Normal file
@ -0,0 +1,6 @@
|
||||
body {
|
||||
margin: 0px;
|
||||
}
|
||||
.vjs-control-bar {
|
||||
font-size: 1rem;
|
||||
}
|
Reference in New Issue
Block a user