视频插件VideoJS5介绍

本文介绍了VideoJS5的使用,包括从官网下载,如何通过plugins.md扩展视频功能,调整视频组件的位置,详细讲解了视频时间格式的修改方法,以及videoJs的事件列表,为开发者提供了全面的VideoJS5操作指南。
摘要由CSDN通过智能技术生成

1:官网下载


2:扩充video功能---plugins.md插件


1:新建一个函数

<span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(0, 102, 0);">  function examplePlugin(options) {
      this.on('play', function(e) {
        console.log('playback has started!');
      });
    };</span></span>

2:把函数定义为插件

<span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(0, 102, 0);">    videojs.plugin('examplePlugin', examplePlugin);</span></span>


3:应用插件
方法一:

<span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(0, 102, 0);">  videojs('vidId', {
      plugins: {
        examplePlugin: {
          exampleOption: true
        }
      }
    });</span></span>

方法二:
<span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(0, 102, 0);">    var video = videojs('cool-vid');
    video.examplePlugin({ exampleOption: true });</span></span>


一个关于新建插件的例子:
新建一个按钮并点击时候视频回到开头并停止


我们在上面的examplePlugin()函数中添加代码

<span style="background-color: rgb(255, 255, 255);"><span style="background-color: rgb(0, 102, 0);">    function examplePlugin(options) {
        
        	        var backplayBtn = document.createElement('div');
        	        backplayBtn.className = 'vjs-backplay-button vjs-menu-button vjs-control';
        	        backplayBtn.innerHTML =
        	          '<div>'
        	            + '<i class="fa fa-step-backward&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值