频道所有源全部卡顿时自动换台

This commit is contained in:
buvta
2021-01-21 15:36:33 +08:00
parent 334933ce82
commit 5d6579326c
2 changed files with 12 additions and 3 deletions

View File

@@ -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)
})

View File

@@ -77,7 +77,7 @@
</div>
<div class="zy-input">
<input type="checkbox" v-model = "d.autoChangeSourceWhenIptvStalling" @change="updateSettingEvent">
卡顿时自动换源:<input style="width:50px" type="number" min=0 v-model.number = "d.waitingTimeInSec" @change="updateSettingEvent">
卡顿时自动换源换台:<input style="width:50px" type="number" min=0 v-model.number = "d.waitingTimeInSec" @change="updateSettingEvent">
</div>
</div>
</div>