Black Lives Matter. Please consider donating to Black Girls Code today.

How to use html.Video?

It only shows a black space and no video is played!
Am I doing something wrong?

html.Div(children = [
        html.Video(
            controls = True,
            id = 'movie_player',
            src = "https://www.youtube.com/watch?v=gPtn6hD7o8g",
            autoPlay=True
        ),
    ])

Hi @digli-dang-dang HTML video element (or the equivalent html.Video) work when you pass in src the URL to a video file (eg an mp4 file). Here you are giving the URL of a youtube page which is a different type of file. If you do

app.layout = html.Div(children = [
        html.Video(
            controls = True,
            id = 'movie_player',
            #src = "https://www.youtube.com/watch?v=gPtn6hD7o8g",
            src = "https://www.w3schools.com/html/mov_bbb.mp4",
            autoPlay=True
        ),
    ])

the video works.

If you need to embed a youtube video maybe you can use an iframe (html.Iframe) as explained in https://support.google.com/youtube/answer/171780?hl=en

Thank you @Emmanuelle. It works! I wanted to actually embed the youtube video! BTW, do you know if dash_player is production ready?