I'm trying to embed a YouTube video on my website. When I paste the video URL, I get the below error:

’Embed’ field code should contained the embed tag with video details

I tried with:

<video src="http://www.youtube.com/watch?v=K4h8jEabFqs" width="300" height="150" controls>
</video>

and it did not work. I also tried with http://www.youtube.com/watch?v=K4h8jEabFqs URL only and the same.

Any idea?

link|improve this question
feedback

closed as off topic by slhck, haimg, techie007, Mokubai, ChrisF Jan 15 at 23:14

Questions on Super User are expected to generally relate to computer software or computer hardware, within the scope defined in the faq.

1 Answer

Copy the embed code from the YouTube video itself:

enter image description here

This is the most commonly used way to embed Flash videos in HTML pages, with the object tag:

Includes an object in the page of the type specified by the type attribute. This may be in any MIME-type the user agent understands, such as an embedded HTML page, a file to be handled by a plug-in such as Flash, a Java applet, a sound file, etc. Standardized in HTML 4.0; still current.


Your video tags don't work because video is new in HTML5. It expects a pointer to a video file, e.g. http://example.com/video.mp4, and not just a link to YouTube.

Directly pasting the URL doesn't work because it's neither a hyperlink (e.g. <a href="http://youtube.com/blah">video</a>), nor does the browser know it should be a video.

link|improve this answer
the object tag does not work with mobiles, use the iframe tag. – HackToHell Jan 15 at 15:01
@HackToHell Oh my, iframes! :) Which mobiles exactly? Recent smartphone browsers shouldn't have a problem with object, and most of them (iOS, Android), will probably open YouTube videos in the separate YouTube player anyway. – slhck Jan 15 at 15:08
The dumber mobiles, and if the computer does not have flash, it runs HTML5 labnol.org/internet/embed-youtube-videos-in-html5-flash/14092 – HackToHell Jan 16 at 9:16
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.