Skip to content
← Back to Community
Linked video won't play
Profile icon
TheDarkSlayer

Hello All,

I am extremely new to coding. I'm teaching myself HTML. I just started my first project on here to practice, and I am trying to add a YouTube video. It appears on the page, but it won't play. I used the video tag, added the URL to the src attribute, and have a closing tag. What am I doing wrong? Halp!

Answered by CatR3kd [earned 5 cycles]
View Answer
Voters
Profile icon
sarve
Profile icon
Dadadams99
Profile icon
SUHASTADIPARTH1
Profile icon
TANMAYBAGADIA
Profile icon
TheDarkSlayer
Comments
hotnewtop
Profile icon
CatR3kd

You need to have the video downloaded in ogg/mp4 format onto the repl and then use videoexample.ogg for the url

Profile icon
TheDarkSlayer

Thank you!

@CatR3kd

Profile icon
CatR3kd

Can you mark my answer as correct please?

@TheDarkSlayer

Profile icon
LucifMosg

Kmhu

Profile icon
RYANTADIPARTHI

Two things - Either copy embedded code from a video URL by right clicking on the video, or write this code - <source src="", in the file, put your video URL. Or you can hit the dots at the top, and get the video you want from your files, and link it in the src, where I showed the empty string.

Profile icon
Coder100

video tags have a (imo) misleading syntax, read more about it here

<video controls width="250"> <source src="..." type="..."> ... <!-- Fallback text --> </video>

But this is a youtube video, and they have even more strange syntax.
So on that specific youtube video:

image

image

And click copy on that bottom embed, so now your HTML code is:

<iframe width="560" height="315" src="https://www.youtube.com/embed/lk6iJNSv-vY" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Profile icon
SUHASTADIPARTH1

Screenshot 2020-10-26 at 8.50.26 PM

Profile icon
SUHASTADIPARTH1

You should copy the embedded code from Youtube. and paste it into your HTML.

Profile icon
SUHASTADIPARTH1

Oh, it doesn't work because you have a youtube URL.

Profile icon
SUHASTADIPARTH1

If it still doesn't work, then you have the URL wrong.

Profile icon
SUHASTADIPARTH1

You should have the video tags like this