Although there is a section of code within meda_youtube.js that checks to see if the browser is HTML5 compatible, this isn't used when generating the embed code.

I've created a patch that also passes the html5 variable into the insertEmbed function, and if this is true, adds an additional option so that html5=1 is added onto the end of the URL, and that triggers the use of the HTML5 player. Of course, if the variable is set the false, the original URL is used and the Flash video player is used as a fallback.

Patch to be attached shortly...

Comments

opdavies’s picture

StatusFileSize
new1.03 KB
RobW’s picture

Why not use the iframe and let Youtube decide if HTML5 is needed or not?

opdavies’s picture

Sorry, I'm not sure that I understand your reply. What do you mean by "Why not use the iframe"?

RobW’s picture

You're already using the iframe, which detects HTML5 or flash capability and chooses the best experience for the browser/device it can. The iframe by itself uses html5 player on devices without flash. The html5 param changes the behavior from:

With flash but no HTML5 = use flash
With HTML5 but no flash = use HTML5
With flash and HTML5 = use flash

to

With flash but no HTML5 = use flash
With HTML5 but no flash = use HTML5
With flash and HTML5 = use HTML5

(http://stackoverflow.com/questions/5845484/force-html5-youtube-video)

I'm guessing this is because the html5 player is less tested, and maybe doesn't have pop up adverts (at least I think I remember hearing that somewhere). In the future, I would bet that the html5=1 behavior will become default.

So the "can this device use html5" test in Media: Youtube (which I'm trying to remove, btw) is just doing the same thing twice. Instead of using the test to load the param, adding a configuration option in the module, something like "Force HTML5 player when available", would probably be a better choice.

Also worth considering is the html5 parameter isn't a documented or officially supported player parameter -- it's not listed in https://developers.google.com/youtube/player_parameters. Should we add a developer parameter that could change or disappear to M:YT options? I could go either way.

bneil’s picture

Instead of using the test to load the param, adding a configuration option in the module, something like "Force HTML5 player when available", would probably be a better choice.

I support this idea. We've been testing the YouTube HTML5 player and it's much more keyboard accessible than using the Flash version, so we'd like to be able to force all videos to use the HTML5 version first.

I believe a colleague of mine is working on a patch for 7.x-2.x to add that configuration option. Should we change this into a feature request against the 7.x-2.x version or create a new issue?

RobW’s picture

Version: 7.x-1.0-beta3 » 7.x-2.x-dev
Category: bug » feature

Works for me.

briand44’s picture

Status: Active » Needs review
StatusFileSize
new2.99 KB

Here is a patch that adds the configuration option "Force HTML5 player when available". If adding videos through the wysiwyg you have to edit and save the node before the video will be displayed using the HTML5 version.

bneil’s picture

The patch works for me as advertised.

bneil’s picture

Title: HTML5 player not being used when using a HTML5 browser » Add an option to use the HTML5 player when available

Updating issue title.

RobW’s picture

Working for me as well. Anyone else testing? I'd like to mark this as RTBC.

RobW’s picture

Status: Needs review » Postponed
StatusFileSize
new5.53 KB

I rerolled the patch against latest dev and made some minor edits. But now when testing (this patch and the one in #7 against earlier dev) the parameter simply does nothing. I tried all sorts of combinations, order of queries, different protocols, and Youtube always loaded the flash player in my (Chrome) browser.

Recent comments on the S.O. thread report mixed or no success with the param. I am going to postpone this until YT documents the parameter or we can consistently reproduce success.

Patch attached for posterity.

stefan.r’s picture

Issue summary: View changes
Status: Postponed » Needs review
StatusFileSize
new2.4 KB

Patch against latest dev.

This works for me in Firefox, whether in HTML5 beta or not. Can anyone else test?

For a keyboard accessible version of a Youtube video, forcing HTML5 video seems to be the best option at this point, so even if this is not working on 100% of browsers and 100% of videos, I still think this option should be added as it seems to work in the majority of cases now. For those other cases, users could always add a disclaimer such as "For a fully keyboard-accessible alternative to this video, view it in Chrome or on any Android or iOS device, view it in Firefox with the YouTube ALL HTML5 add-on installed, or disable Flash in Internet Explorer".

Stackexchange thread for reference:
http://stackoverflow.com/questions/5845484/force-html5-youtube-video

stefan.r’s picture

Title: Add an option to use the HTML5 player when available » Add an option to force the HTML5 player when available
stefan.r’s picture

Please can anyone review this so we can get this committed? Thanks!

oivind’s picture

Installed patch #12 on 7.x-2.0-rc5. It does not work in latest Firefox.

If I understand this correctly, this patch should do more or less the same as when selecting the "Request the HTML5 player" button on https://www.youtube.com/html5. If I press this button the HTML5 player will be used in the iframe.

oivind’s picture

OK, it finally works. It turned out that I didn't have the right settings in admin/structure/file-types/manage/video/file-display. I also had to modify my view.

stefan.r’s picture

Status: Needs review » Closed (won't fix)