mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-05-10 00:02:16 +08:00
修复播放器初始状态时点击播放时的bug,并给直播加上对应功能
This commit is contained in:
@@ -346,6 +346,7 @@ export default {
|
||||
channelList: [],
|
||||
channelListForShow: [],
|
||||
channelListShow: false,
|
||||
isLive: false,
|
||||
defaultProps: {
|
||||
label: 'label',
|
||||
children: 'children'
|
||||
@@ -541,6 +542,7 @@ export default {
|
||||
channelList.add(ele)
|
||||
},
|
||||
playChannel (channel) {
|
||||
this.isLive = true
|
||||
if (channel.channels) {
|
||||
this.right.sources = channel.channels.filter(e => e.isActive)
|
||||
channel = channel.prefer ? channel.channels.find(e => e.id === channel.prefer) : channel.channels.filter(e => e.isActive)[0]
|
||||
@@ -559,6 +561,7 @@ export default {
|
||||
document.querySelector('.xgplayer-playbackrate').style.display = 'none'
|
||||
},
|
||||
playVideo (index = 0, time = 0) {
|
||||
this.isLive = false
|
||||
document.querySelector('xg-btn-showhistory').style.display = 'block'
|
||||
document.querySelector('.xgplayer-playbackrate').style.display = 'inline-block'
|
||||
this.fetchM3u8List().then(m3u8Arr => {
|
||||
@@ -1399,11 +1402,15 @@ export default {
|
||||
})
|
||||
|
||||
this.xg.on('play', () => {
|
||||
if (!this.video.key && !this.video.info.ids) {
|
||||
// 如果当前播放页面的播放信息没有被赋值,播放历史记录
|
||||
var historyItem = this.right.history[0]
|
||||
this.video = { key: historyItem.site, info: { id: historyItem.ids, name: historyItem.name, index: historyItem.index } }
|
||||
this.getUrls()
|
||||
if (!this.video.key) {
|
||||
if (!this.video.iptv && !this.video.info.ids) {
|
||||
// 如果当前播放页面的播放信息没有被赋值,播放历史记录
|
||||
var historyItem = this.right.history[0]
|
||||
this.video = { key: historyItem.site, info: { id: historyItem.ids, name: historyItem.name, index: historyItem.index } }
|
||||
this.getUrls()
|
||||
} else if (this.video.iptv && !this.isLive) {
|
||||
this.playChannel(this.video.iptv)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -1419,6 +1426,7 @@ export default {
|
||||
this.xg.destroy(false)
|
||||
this.xg = null
|
||||
this.name = ''
|
||||
this.isLive = false
|
||||
this.right.list = []
|
||||
this.getAllhistory()
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user