From 11e7ffc554bf5c65bae5b58f78945c5e07fd1b54 Mon Sep 17 00:00:00 2001 From: Hunlongyu Date: Mon, 19 Oct 2020 16:31:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=91=20=E6=96=B0=E5=A2=9E=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=81=9C=E6=AD=A2=E6=92=AD=E6=94=BE=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Play.vue | 125 +++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 65 deletions(-) diff --git a/src/components/Play.vue b/src/components/Play.vue index 01570aa..8e9c014 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -189,6 +189,7 @@ export default { playbackRate: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 3, 4, 5], playPrev: true, playNextOne: true, + videoStop: true, showList: true, showHistory: true, videoTitle: true @@ -990,6 +991,10 @@ export default { this.toggleHistory() }) + this.xg.on('videoStop', () => { + this.videoStop() + }) + const ev = ['click', 'touchend', 'mousemove'] let timerID ev.forEach(item => { @@ -1012,6 +1017,14 @@ export default { this.xg.on('exitFullscreen', () => { document.querySelector('.xg-view-videoTitle').style.display = 'none' }) + }, + videoStop () { + this.xg.destroy() + this.config.src = '' + this.name = '' + this.right.list = [] + this.showNext = false + this.xg = new Hls(this.config) } }, created () { @@ -1025,6 +1038,9 @@ export default { Player.install('playNextOne', function () { addPlayerBtn.bind(this, 'playNextOne', '', { title: '下一集' })() }) + Player.install('videoStop', function () { + addPlayerBtn.bind(this, 'videoStop', '', { title: '停止播放' })() + }) Player.install('showList', function () { addPlayerBtn.bind(this, 'showList', '', { title: '播放列表' })() }) @@ -1062,7 +1078,11 @@ export default { }