add js
This commit is contained in:
parent
d080d51287
commit
3d2c1609bc
16
index.html
16
index.html
@ -4,8 +4,20 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/{{ videojs_version }}/video.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<video class="video-js" data-setup='{}' controls>
|
<video class="video-js" id="player" controls>
|
||||||
<source src="{{ stream }}" type="{{ content_type }}" />
|
|
||||||
</video>
|
</video>
|
||||||
|
<script>
|
||||||
|
let xhr = new XmlHttpRequest();
|
||||||
|
xhr.onreadystatechange = () => {
|
||||||
|
let ctype = xhr.getResponseHeader("Content-Type");
|
||||||
|
let player = videojs("player");
|
||||||
|
let source = {};
|
||||||
|
source.type = ctype;
|
||||||
|
source.src = {{ stream }};
|
||||||
|
player.src(source);
|
||||||
|
}
|
||||||
|
xhr.open("HEAD", {{ stream }}, true);
|
||||||
|
xhr.send();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -153,9 +153,7 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
def handle_render(self, provider, write):
|
def handle_render(self, provider, write):
|
||||||
if template is not None:
|
if template is not None:
|
||||||
stream_path = f'{self.request.path}?provider={provider}'
|
stream_path = f'{self.request.path}?provider={provider}'
|
||||||
stream_url = f'http://127.0.0.1:8080{stream_path}'
|
rendered = template.generate(stream=stream_path, videojs_version=videojs_version)
|
||||||
ctype = upstream_type(stream_url, None)
|
|
||||||
rendered = template.generate(stream=stream_path, content_type=ctype, videojs_version=videojs_version)
|
|
||||||
self.write(rendered)
|
self.write(rendered)
|
||||||
else:
|
else:
|
||||||
self.set_status(404)
|
self.set_status(404)
|
||||||
|
Loading…
Reference in New Issue
Block a user