MediaElement.js - force Chrome to use flash player?

旧时模样 提交于 2019-11-30 15:12:48

Here you go:

new MediaElementPlayer('video',{mode:'shim'});
russ24

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.

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 ) ;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!