From f91200e609299134938d1a57f8285a3485f87157 Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Sat, 28 Nov 2020 12:46:10 +0100 Subject: [PATCH] =?UTF-8?q?=E9=9D=9Em3u8=E8=A7=86=E9=A2=91,=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=9C=A8=E7=BA=BF=E8=A7=A3=E6=9E=90=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Play.vue | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/components/Play.vue b/src/components/Play.vue index abb21b2..b7c4062 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -506,25 +506,30 @@ export default { document.querySelector('xg-btn-showhistory').style.display = 'block' document.querySelector('.xgplayer-playbackrate').style.display = 'inline-block' this.fetchM3u8List().then(m3u8Arr => { - this.xg.src = m3u8Arr[index] - - if (time !== 0) { - this.xg.play() - this.xg.once('playing', () => { - this.xg.currentTime = time - }) + const url = m3u8Arr[index] + if (!m3u8Arr[index].endsWith('.m3u8')) { + const onlineUrl = 'https://www.1717yun.com/jiexi/?url=' + url + const open = require('open') + open(onlineUrl) } else { - this.xg.play() - } - - this.videoPlaying() - this.xg.once('ended', () => { - if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > index)) { - this.video.info.time = 0 - this.video.info.index++ + this.xg.src = m3u8Arr[index] + if (time !== 0) { + this.xg.play() + this.xg.once('playing', () => { + this.xg.currentTime = time + }) + } else { + this.xg.play() } - this.xg.off('ended') - }) + this.videoPlaying() + this.xg.once('ended', () => { + if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > index)) { + this.video.info.time = 0 + this.video.info.index++ + } + this.xg.off('ended') + }) + } }) }, fetchM3u8List () {