From 5d6579326c9c8fb43702c4f33daaf6c451b8077f Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Thu, 21 Jan 2021 15:36:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=91=E9=81=93=E6=89=80=E6=9C=89=E6=BA=90?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=8D=A1=E9=A1=BF=E6=97=B6=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=8D=A2=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Play.vue | 13 +++++++++++-- src/components/Setting.vue | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Play.vue b/src/components/Play.vue index 23104fe..e95b037 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -1420,18 +1420,27 @@ export default { }) }, bindEvent () { + // 直播卡顿时换源换台 let stallIptvTimeout + let stallCount = 0 this.xg.on('waiting', () => { - if (this.isLive && this.setting.autoChangeSourceWhenIptvStalling && this.right.sources.length > 1) { + if (this.isLive && this.setting.autoChangeSourceWhenIptvStalling) { stallIptvTimeout = setTimeout(() => { let index = this.right.sources.indexOf(this.video.iptv) + 1 if (index === this.right.sources.length) index = 0 + stallCount++ clearTimeout(stallIptvTimeout) - this.playChannel(this.right.sources[index]) + if (stallCount >= this.right.sources.length) { + stallCount = 0 + this.nextEvent() + } else { + this.playChannel(this.right.sources[index]) + } }, this.setting.waitingTimeInSec * 1000) } }) this.xg.on('canplay', () => { + stallCount = 0 if (stallIptvTimeout) clearTimeout(stallIptvTimeout) }) diff --git a/src/components/Setting.vue b/src/components/Setting.vue index 382aac7..c9e968c 100644 --- a/src/components/Setting.vue +++ b/src/components/Setting.vue @@ -77,7 +77,7 @@