<video> tag not playing video

I’m working on a practice site, and I’ve included two video tags. However, while the video player itself is inserted, the video isn’t. The screen is grey, and none of the controls can be altered. Here’s how I wrote the tags.

video width=“500px” height=“500px” controls
source src=“My Bloody Valentine - Only Shallow (Official Music Video) - YouTube” type=“video/mp4”
/video

I obviously included the “<” and “>” in the code itself, but I had to remove them from this post so that you could see the rest of the code.
Should probably mention that I’m using the program Brackets, and my browser is Google Chrome

Heya, welcome to the forums!

The video tag is for embedding videos that you have as a directly as a file (for example an .mp4). For a youtube video, you do not have it as a file and therefore you cannot put it as an src (note the youtube link does not end in a video file extension). Instead you must follow youtubes official, slightly different way of embedding videos:

It uses an <iframe> tag, used to embed content from another website into your website, instead, which is a little different, for example (copy-pasted from the Share → Embed option on a yt video):

<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
1 Like