i am trying to embed an mp4 video in dash, it only shows video player, but can not play the video,
import dash
from dash import html
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1("MP4 Video Example"),
html.Video(
controls=True,
src=r"D:/Pak_Kontut/RYK.mp4", #MP4 video file
style={'width': '80%', 'height': 'auto'}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
1 Like
AIMPED
2
Hey @Ahmad7886, we had similar topic in the past. Did you try the forum search?
https://community.plotly.com/search?q=video
hi @Ahmad7886
Would Dash Player work for you?
If you uploaded the video somewhere online (YouTube, Vimeo, etc.), you could use assign it to the url
property of Dash Player to play the video.
thawro
4
You need to put the video files into assets
directory (plotly docs) and then pass src= "/assets/video.mp4"
The whole code:
import dash
import dash_html_components as html
video_url = "/assets/video.mp4"
app = dash.Dash(__name__)
app.layout = html.Div(
[
html.H1("Plot with Embedded Video"),
html.Video(src=video_url, controls=True, width=560, height=315),
]
)
if __name__ == "__main__":
app.run_server(debug=True)
2 Likes