add attributes

This commit is contained in:
Roy Olav Purser 2021-05-13 17:44:16 +02:00
parent 1632e2f7e0
commit eeb2d6db9d
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -75,7 +75,7 @@ if icecast_server is not None and stream_server is not None:
template_html = None
template_js = None
template_embed = tornado.template.Template('<iframe src="{{ origin }}?provider={{ provider }}&render=true" allow="fullscreen"></iframe>')
template_embed = tornado.template.Template('<iframe src="{{ origin }}?provider={{ provider }}&render=true" width="{{ width }}" height="{{ height }}" allow="fullscreen"></iframe>')
videojs_version = None
castjs_version = None
@ -218,7 +218,6 @@ class MainHandler(tornado.web.RequestHandler):
elif isinstance(height_str, str):
height = int((height // 9) * 9)
width = int((height * 16) // 9)
origin = self.request.path
if stream_server is not None:
origin = f'{stream_server}{self.request.path}'
@ -227,7 +226,9 @@ class MainHandler(tornado.web.RequestHandler):
embed_json["type"] = "video"
embed_json["width"] = width
embed_json["height"] = height
embed_json["html"] = str(template_embed.generate(origin=origin, provider=provider), "utf-8")
embed_json["provider_name"] = "stream.purser.it"
embed_json["provider_url"] = "https://stream.purser.it"
embed_json["html"] = str(template_embed.generate(origin=origin, provider=provider, width=width, height=height), "utf-8")
self.set_header("Content-Type", "application/json; charset=utf-8")
self.write(json.dumps(embed_json))