7

How do I play a YouTube video in HTML5?

Gert Grenander
  • 16,866
  • 6
  • 40
  • 43
Tricia Fish
  • 71
  • 1
  • 1
  • 2

4 Answers4

7

This is probably what you're looking for: Force HTML5 youtube video

HTML5 video may play if the user has opted in:

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0"> </iframe>

HTML5-by-defualt video - notice the ?html5=1:

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID?html5=1" frameborder="0"> </iframe>

The "HTML5" way of doing video would be to use a <video> tag. This post shows that it can be done, but it doesn't look like the best option. Show Youtube video source into HTML5 video tag?

Community
  • 1
  • 1
Dennis
  • 593
  • 6
  • 11
6

You can also take a look how YouTube does it, opt in at: http://www.youtube.com/html5

pts
  • 80,836
  • 20
  • 110
  • 183
  • just for those who are lazzy to look into the source, from the form of the page mentioned above, clicking on the switcher button, it posts enable_html5=true for enabling and disable_html5=true for disabling the html5 default player – Hofi Aug 24 '14 at 00:55
0

If you're using safari, there's an YouTube5 extension that will make all youtube videos into html5 videos.

http://www.verticalforest.com/2010/06/09/youtube5-html5-converter-for-youtube-videos/

Supports videos that youtube does not (videos with ads etc)

MoDFoX
  • 2,134
  • 2
  • 21
  • 22
0

You can embed videos effortlessly by right clicking the video on youtube, copying the embed video option, and pasting it in your html where you want it to appear, The problem with this you wont have control over what is shown in the embed code apart from the clip you are interested in, ie, adverts playlists etc

TechPotter
  • 579
  • 8
  • 14