X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

If you want to play a video in a web page, you can upload the video to YouTube and insert the proper HTML code, in your web page, to display the video:

Example - Using iFrame

<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.




Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook