Force HTML5 youtube video
Solution 1:
I've found the solution :
You have to add the html5=1
in the src attribute of the iframe :
<iframe src="http://www.youtube.com/embed/dP15zlyra3c?html5=1"></iframe>
The video will be displayed as HTML5 if available, or fallback into flash player.
Solution 2:
Whether or not YouTube videos play in HTML5 format depends on the setting at https://www.youtube.com/html5, per browser. Chrome prefers HTML5 playback automatically, but even the latest Firefox and Internet Explorer still use Flash if it is installed on the machine.
The parameter html5=1 does not do anything (anymore) now. (Note it is not even listed at https://developers.google.com/youtube/player_parameters.)
Solution 3:
I tried using the iframe embed code and the HTML5 player appeared, however, for some reason the iframe was completely breaking my site.
I messed around with the old object embed code and it works perfectly fine. So if you're having problems with the iframe here's the code i used:
<object width="640" height="360">
<param name="movie" value="http://www.youtube.com/embed/VIDEO_ID?html5=1&rel=0&hl=en_US&version=3"/>
<param name="allowFullScreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<embed width="640" height="360" src="http://www.youtube.com/embed/VIDEO_ID?html5=1&rel=0&hl=en_US&version=3" class="youtube-player" type="text/html" allowscriptaccess="always" allowfullscreen="true"/>
</object>
hope this is useful for someone
Solution 4:
If you're using the iframe embed api, you can put html5:1
as one of the playerVars
arguments, like so:
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: '<VIDEO ID>',
playerVars: {
html5: 1
},
});
Totally works.