Commit e0efe642 authored by 张伯涛's avatar 张伯涛

res-2.0-b(1)视频播放去掉自动播放,(2)第一次播放完后可以拖拽进度条

parent 794dcce5
......@@ -409,6 +409,7 @@ export default {
},
data() {
return {
videoDrag: false, // 视频是否可以拖动(当视频看完后视频可以拖动)
Appraisal: '',
firstCurrent: {}, // 播放页面播放的视频对象
unitView: false,
......@@ -1184,6 +1185,12 @@ export default {
// * @param sectionKey 点击的当前节的数组索引(Number)
*/
sectionClick(section, chapterIndex) {
console.log('section', section)
if (section.isComplete === '1') {
this.videoDrag = true
} else {
this.videoDrag = false
}
this.firstCurrent = section // 播放页面播放的视频对象
console.log(section, chapterIndex)
/* // 先判断章节的sort排序值是否正确,有误则结束执行以下代码。
......@@ -1412,24 +1419,25 @@ export default {
},
/** 视频播放完自动播放下一个视频*/
playNextVideo() {
// console.log('next', this.chapterList)
// console.log('now', this.firstCurrent)
const flattenedArray = this.flattenTree(this.chapterList) // 获取有videoUrl的对象数组
const flattenedArrayAll = this.flattenTreeAll(this.chapterList) // 获取全部对象数组
// 获取当前对象在数组中的索引
const currentIndex = flattenedArray.findIndex(obj => obj.businessId === this.firstCurrent.businessId)
// console.log('currentIndex', currentIndex)
if (currentIndex + 1 <= flattenedArray.length - 1) {
const nextVideo = flattenedArray[currentIndex + 1] // 自动播放的下一个视频对象
const parentSort = flattenedArrayAll.filter(item => item.businessId === nextVideo.pid)
// console.log('parentSort', parentSort)
// console.log('parentSort', parentSort[0].sort)
// console.log('nextVideo', nextVideo)
this.sectionClick(nextVideo, parentSort[0].sort)
}
// console.log('flattenedArray', flattenedArray)
// console.log('flattenedArrayAll', flattenedArrayAll)
this.currentSection.isComplete = '1'
// // console.log('next', this.chapterList)
// // console.log('now', this.firstCurrent)
// const flattenedArray = this.flattenTree(this.chapterList) // 获取有videoUrl的对象数组
// const flattenedArrayAll = this.flattenTreeAll(this.chapterList) // 获取全部对象数组
//
// // 获取当前对象在数组中的索引
// const currentIndex = flattenedArray.findIndex(obj => obj.businessId === this.firstCurrent.businessId)
// // console.log('currentIndex', currentIndex)
// if (currentIndex + 1 <= flattenedArray.length - 1) {
// const nextVideo = flattenedArray[currentIndex + 1] // 自动播放的下一个视频对象
// const parentSort = flattenedArrayAll.filter(item => item.businessId === nextVideo.pid)
// // console.log('parentSort', parentSort)
// // console.log('parentSort', parentSort[0].sort)
// // console.log('nextVideo', nextVideo)
// this.sectionClick(nextVideo, parentSort[0].sort)
// }
// // console.log('flattenedArray', flattenedArray)
// // console.log('flattenedArrayAll', flattenedArrayAll)
},
/** 获取有videoUrl的对象数组*/
flattenTree(treeData) {
......@@ -1472,6 +1480,11 @@ export default {
onPlayerTimeupdate(player) {
this.currentPlayTime = player.currentTime()
this.maxPosition = this.maxPosition < player.currentTime() ? player.currentTime() : this.maxPosition
if (this.videoDrag === true) {
const vjsProgress = document.getElementsByClassName('vjs-progress-control')
vjsProgress[0].style.pointerEvents = 'auto'
vjsProgress[0].style.cursor = 'default'
}
// console.log('player Timeupdate!', player.currentTime(), this.allPlayTime)
if ((this.currentPlayTime + 1) >= this.allPlayTime) {
const vjsProgress = document.getElementsByClassName('vjs-progress-control')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment