From 1cfc12ec19aebb059c24e3c1d472a1c9e4d80656 Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Sat, 5 Dec 2020 23:46:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A1=AE=E4=BF=9D=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E5=A4=9A=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Play.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Play.vue b/src/components/Play.vue index f00c13e..da89a6b 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -463,12 +463,12 @@ export default { const db = await history.find({ site: this.video.key, ids: this.video.info.id }) const key = this.video.key + '@' + this.video.info.id var time = this.video.info.time + this.xg.removeAllProgressDot() if (db) { if (!time && db.index === index) { // 如果video.info.time没有设定的话,从历史中读取时间进度 time = db.time } if (!VIDEO_DETAIL_CACHE[key]) VIDEO_DETAIL_CACHE[key] = {} - this.xg.removeAllProgressDot() if (db.startPosition) { VIDEO_DETAIL_CACHE[key].startPosition = db.startPosition } @@ -529,12 +529,13 @@ export default { if (VIDEO_DETAIL_CACHE[key].endPosition) this.xg.addProgressDot(this.xg.duration - VIDEO_DETAIL_CACHE[key].endPosition, '片尾') }) this.videoPlaying() + VIDEO_DETAIL_CACHE[key].skipend = false this.xg.once('ended', () => { if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > index)) { this.video.info.time = 0 this.video.info.index++ } - if (!VIDEO_DETAIL_CACHE[key].endPosition) this.xg.off('ended') + this.xg.off('ended') }) } }) @@ -542,7 +543,7 @@ export default { fetchM3u8List () { return new Promise((resolve) => { const cacheKey = this.video.key + '@' + this.video.info.id - if (VIDEO_DETAIL_CACHE[cacheKey] && VIDEO_DETAIL_CACHE[cacheKey].list) { + if (VIDEO_DETAIL_CACHE[cacheKey] && VIDEO_DETAIL_CACHE[cacheKey].list && VIDEO_DETAIL_CACHE[cacheKey].list.length) { this.name = VIDEO_DETAIL_CACHE[cacheKey].name resolve(VIDEO_DETAIL_CACHE[cacheKey].list) } @@ -1278,7 +1279,10 @@ export default { if (VIDEO_DETAIL_CACHE[key] && VIDEO_DETAIL_CACHE[key].endPosition) { const time = this.xg.duration - VIDEO_DETAIL_CACHE[key].endPosition - this.xg.currentTime if (time > 0 && time < 0.3) { - this.xg.emit('ended') + if (!VIDEO_DETAIL_CACHE[key].skipend) { + VIDEO_DETAIL_CACHE[key].skipend = true + this.xg.emit('ended') + } } } })