html5media api文档,API · etianen/html5media Wiki · GitHub

html5media API

html5media provides a simple API to allow additional customization and control.

Place any references to the html5media API in a separate

of your document, after the html5media

Custom flowplayer.swf

html5media uses the open-source version of Flowplayer as a fallback flash player.

If you've got your own commercial license for Flowplayer that you'd like to

use instead, then you can specify alternate versions of the Flowplayer SWF files to use.

html5media.flowplayerSwf = "/path/to/your/flowplayer.swf";

html5media.flowplayerControlsSwf = "/path/to/your/flowplayer.controls.swf";

Custom flowplayer configuration

html5media provides a hook to customise the Flowplayer configuration. You can edit the default flowplayer configuration by defining the following function:

/**

* This callback should return the updated Flowplayer configuration.

* The default implementation leaves the generated configuration intact.

*/

html5media.configureFlowplayer = function(element, config) {

return config;

}

Forcing the flash fallback

html5media will normally only use the flash fallback when the browser cannot use a native player. However, it's possible

to force html5media to use the flash fallback globally, or for a specific browser or element.

As a simple case, the following code will force the fallback for all elements in all browsers.

html5media.forceFallback = function(tagName, element) {

return true; // Always use the fallback.

}

As another example, the following code will only force the fallback for Internet Explorer.

html5media.forceFallback = function(tagName, element) {

return (/MSIE (\d+.\d+);/.test(navigator.userAgent));

}

Custom CSS class names for flash fallback

Target the flash fallback player with custom CSS class names.

html5media.videoFallbackClass = "html5media-video-fallback";

html5media.audioFallbackClass = "html5media-audio-fallback";

Dynamically generated video and audio tags

Whenever you create dynamic and tags using javascript, always call html5media()

to create the fallback players for legacy browsers.

createSomeDynamicVideoTags(); // Create the dynamic media tags.

html5media(); // Create fallbacks for legacy browsers.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值