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

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

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