video
视频播放组件。
子组件
不支持。
属性
事件
方法
示例
<!-- xxx.hml -->
<div>
<video id='videoId' src='/common/mydream.mp4' muted='false' autoplay='false' controls="true" onstart='startCallback' onpause='pauseCallback' onfinish='finishCallback' onerror='errorCallback' onseeking='seekingCallback' onseeked='seekedCallback' ontimeupdate='timeupdateCallback' onclick="change_start_pause"></video>
</div>
/* xxx.js */
export default {
data: {
event:'',
seekingtime:'',
timeupdatetime:'',
seekedtime:'',
isStart: true,
},
startCallback:function(){ this.event = '视频开始播放'; },
pauseCallback:function(){ this.event = '视频暂停播放'; },
finishCallback:function(){ this.event = '视频播放结束'; },
errorCallback:function(){ this.event = '视频播放错误'; },
seekingCallback:function(e){ this.seekingtime = e.currenttime; },
timeupdateCallback:function(e){ this.timeupdatetime = e.currenttime;},
change_start_pause: function() {
if(this.isStart) {
this.$element('videoId').pause();
this.isStart = false;
} else {
this.$element('videoId').start();
this.isStart = true;
}
}
}