HTML YouTube Videos


The easiest way to play videos in HTML, is to use YouTube.


Struggling with Video Formats?

Different versions of different browsers support different video formats.

Earlier in this tutorial, you have seen that you might have to convert your videos to different video formats, to make sure they play in all browsers.

Converting videos to different format can be difficult and time consuming.

An easier solution might be to let YouTube play the videos in your web pages.


Playing a YouTube Video in HTML

To play your video on a web page, you can upload it to YouTube, and then insert the proper HTML code in your web page to display iit:

Example - Using iFrame (this is the recommended method)

<iframe width="420" height="315"
src="http://www.youtube.com/embed/XGSy3_Czz8k">
</iframe>

Try it Yourself »

Example - Using <object>

<object width="420" height="315"
data="http://www.youtube.com/v/XGSy3_Czz8k">
</object>

Try it Yourself »

Example - Using <embed>

<embed width="420" height="315"
src="http://www.youtube.com/v/XGSy3_Czz8k">

Try it Yourself »

Note YouTube will display the code to use (like:XGSy3_Czz8k), when you click "Share" under the video.




Color Picker

colorpicker