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 { }