Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Cannot play local mp4 videos with html.Video

Hello, happy new year, and please excuse me for this basic question.

I have a very simple app here, in which I want to simply load a .mp4 video that’s stored locally on my computer, and play it. For some reason, all I get is a video player that hasn’t loaded the video and the play button is disabled. I would appreciate any help. I’m on a mac, so could it be due to file permissions or anything like that? I also tried on Ubuntu, same behavior.

I’ve tried different filepaths, and a different mp4 file.

My code is as follows:

import dash
from dash import html

app = dash.Dash(__name__)

app.layout = html.Div(children = [
        html.Video(
            controls = True,
            id = 'movie_player',
            src = "/Users/giannisdimaridis/Desktop/movie.mp4",
            autoPlay=True
        ),
    ])

if __name__ == '__main__':
    app.run_server(debug=True)

Hello @gdims and Happy New Year,

It is recommended to have all the static files (images, videos, etc) inside an assets folder on the same path where your app.py file resides. Adding Static Assets | Dash for Python Documentation | Plotly

Just paste your video file inside the assets folder and change the path to src = "assets/movie.mp4"

1 Like

Thank you so much! It works fine.

1 Like