赞
踩
1.首先下载Video。js
2.引入:import Video from 'video.js'
3.页面中使用:
<video
style="display:none"
:id="'myVideo'+index"
class="video-js"
:src="item.sourceUrl"
controls
preload="auto">
</video>
4. 后台返回数据做处理:
this.$nextTick(() => {
let myCollection = document.getElementsByClassName('video-js')
this.durationT = []
Array.from(myCollection).map((item, index) => {
var myPlayer = Video('myVideo' + index, {
preload: 'auto',
controlBar: {
'durationDisplay': true
}
}, () => {
this.timer = setTimeout(() => {
this.durationT.push(myPlayer.controlBar.durationDisplay.formattedTime_)
}, 200)
})
})
})
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。