dynamic content type

This commit is contained in:
Roy Olav Purser 2021-05-12 01:04:45 +02:00
parent fb2561c776
commit 832cb49357
Signed by: roypur
GPG Key ID: E14D26A036F21656
2 changed files with 4 additions and 3 deletions

View File

@ -5,8 +5,7 @@
</head> </head>
<body> <body>
<video class="video-js" data-setup='{}' controls> <video class="video-js" data-setup='{}' controls>
<source src="{{ stream }}" type="video/mp4" /> <source src="{{ stream }}" type="{{ content_type }}" />
<source src="{{ stream }}" type="application/vnd.apple.mpegurl" />
</video> </video>
</body> </body>
</html> </html>

View File

@ -150,7 +150,9 @@ 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}'
rendered = template.generate(stream=stream_path, videojs_version=videojs_version) stream_url = f'http://127.0.0.1:8080{stream_path}'
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)