我试图在我的Streamlit主页上显示一个无声的循环视频,运行在Chrome上:
col1, col2 = st.columns([1, 1])
video_html = """
<video width="320" height="240" autoplay loop>
<source
src="resources/video (online-video-cutter.com).mp4"
type="video/mp4" />
</video>
"""
col2.markdown(video_html, unsafe_allow_html=True)
然而,一旦我运行应用程序,我就看不到任何东西(字面意思是,一个空白页)。
我怎样才能正确地自动播放这个无声的视频并解决这个问题?
发布于 2022-01-12 10:48:06
添加以下属性:
autoplay="true" -- For autoplay
muted="true" -- For mute
loop="true" -- For Loop
<video controls width="250" autoplay="true" muted="true" loop="true">
<source
src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm"
type="video/mp4" />
</video>
mdn:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-muted https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-autoplay
https://stackoverflow.com/questions/70680012
复制相似问题