why not put_video ??? #212
Replies: 4 comments
-
If you want to show a video which is from the internet, you can use this code: url = "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
put_html('<video controls="controls" src="{url}"></video>'.format(url=url)) If you want to show a video from local file, one way is to use import pywebio
def main():
url = "static/video.mp4"
pywebio.output.put_html('<video controls="controls" src="{url}"></video>'.format(url=url))
pywebio.start_server(main, static_dir='video/', port=8080) You need put your video file By using this way, anyone can use the link If you want the video to only be accessed by current user, you can provide video content with a base64 encoded Data URI as source: from base64 import b64encode
content = open('video.mp4', 'rb').read()
b64content = b64encode(content).decode('ascii')
src = "data:;base64, {b64content}".format(b64content=b64content)
put_html('<video controls="controls" src="{url}"></video>'.format(url=src)) However, in the data uri way, the video can't be show until the whole file are transfered to user broswer, this may be very slow. |
Beta Was this translation helpful? Give feedback.
-
Since you need to consider so many things like this, I don't add the |
Beta Was this translation helpful? Give feedback.
-
Thanks again!
…------------------ 原始邮件 ------------------
发件人: "pywebio/PyWebIO" ***@***.***>;
发送时间: 2021年11月24日(星期三) 晚上7:26
***@***.***>;
***@***.******@***.***>;
主题: Re: [pywebio/PyWebIO] why not put_video ??? (Discussion #212)
Since you need to consider so many things like this, I don't add the put_video() to pywebio. But I think I will add put_video() supporting to my to-do list.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Beta Was this translation helpful? Give feedback.
-
We really need put_video!!! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
why not put_video ???
Beta Was this translation helpful? Give feedback.
All reactions