问题
We're having problems with Chrome crashing, and it seems to be related to the html5 video player, is there any way to force MediaElement.js to use the flash player even if html5 is supported? I can do a browser test in jQuery if I can figure out what setting to pass to mediaelement.
I've seen a few tantalizing suggestions in blogs and forums that this can be done, but I'm not seeing a specific option in the documentation. Any help would be very much appreciated!
回答1:
Here you go:
new MediaElementPlayer('video',{mode:'shim'});
回答2:
I used the mode:shim
on a site that was giving inexplicable problems with IE9's html5 interpretation. however, this mode tag forced all browsers to fall back to flash, and this was not desirable.
So I used conditional comments to specify IE9 and force it to use flash (or silverlight if that's your preference)
var player = new MediaElementPlayer('video', {
/*@cc_on
@if (@_jscript_version == 9)
mode: 'shim',
@end
@*/
// shows debug errors on screen
enablePluginDebug: false,
// etc...
}
This won't work for chrome, and I don't know of a chrome-specific workaround, but for anyone who stumbled on this answer as I did for IE problems, I hope it helps.
In reference to: Mediaelement.js malfunction in IE, no flashback works.
回答3:
You have to modify the code to achieve this . Find below given code in MediaElement.js or mediaelement-and-player.js file.
t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid );
to
t.supportsMediaTag = ( !t.isChrome) && (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid ) ;
来源:https://stackoverflow.com/questions/5111222/mediaelement-js-force-chrome-to-use-flash-player