add oembed dada-url
This commit is contained in:
parent
9e23554678
commit
8ed4aafc64
@ -1,10 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link type="application/json+oembed" href="{{ oembed }}" />
|
||||
<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">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@silvermine/videojs-chromecast@{{ chromecast_version }}/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://cdn.jsdelivr.net/npm/@silvermine/videojs-chromecast@{{ chromecast_version }}/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 }}">
|
||||
|
@ -1,13 +1,3 @@
|
||||
body {
|
||||
margin: 0px;
|
||||
}
|
||||
/*
|
||||
.video-js {
|
||||
font-size: 1rem;
|
||||
}
|
||||
@media (pointer:coarse) and (orientation:portrait) {
|
||||
.video-js {
|
||||
font-size: 3rem;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -33,9 +33,9 @@ if playlist is not None:
|
||||
with open("/app/sources.json", "w+") as f:
|
||||
f.write(json.dumps(playlist))
|
||||
try:
|
||||
resp = requests.get("https://api.cdnjs.com/libraries/castjs?fields=version")
|
||||
resp = requests.get("https://registry.npmjs.org/@silvermine/videojs-chromecast")
|
||||
data = json.loads(resp.text)
|
||||
chromecast_version = data["version"]
|
||||
chromecast_version = data["dist-tags"]["latest"]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
else:
|
||||
|
12
stream.py
12
stream.py
@ -174,9 +174,15 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
if template_js is not None and template_html is not None:
|
||||
stream_path = f'{self.request.path}?provider={provider}'
|
||||
rendered_js = template_js.generate(stream=stream_path);
|
||||
b64 = str(base64.b64encode(rendered_js), "ascii")
|
||||
script = f'data:text/javascript;charset=utf-8;base64,{b64}'
|
||||
rendered_html = template_html.generate(script=script, videojs_version=videojs_version, chromecast_version=chromecast_version, custom_style=custom_style)
|
||||
b64_js = str(base64.b64encode(rendered_js), "ascii")
|
||||
script = f'data:text/javascript;charset=utf-8;base64,{b64_js}'
|
||||
embed_json = {}
|
||||
embed_json["version"] = "1.0"
|
||||
embed_json["type"] = "video"
|
||||
embed_json["html"] = f'<iframe src="{self.request.uri}"></iframe>'
|
||||
b64_frame = str(base64.b64encode(bytes(json.dumps(embed_json), "utf-8")), "ascii")
|
||||
oembed = f'data:application/json+oembed;charset=utf-8;base64,{b64_frame}'
|
||||
rendered_html = template_html.generate(script=script, videojs_version=videojs_version, chromecast_version=chromecast_version, custom_style=custom_style, oembed=oembed)
|
||||
self.write(rendered_html)
|
||||
else:
|
||||
self.set_status(404)
|
||||
|
Loading…
Reference in New Issue
Block a user