diff --git a/src/components/Play.vue b/src/components/Play.vue
index e125d29..d058d22 100644
--- a/src/components/Play.vue
+++ b/src/components/Play.vue
@@ -293,11 +293,10 @@ export default {
clearInterval(this.timer)
this.timer = null
}
- if (this.xg) {
- if (this.xg.hasStart) {
- this.xg.pause()
- }
+ if (this.xg && this.xg.hasStart) {
+ this.xg.pause()
}
+
if (this.video.iptv) {
// 是直播源,直接播放
this.playUrl(this.video.iptv.url)
@@ -1019,25 +1018,59 @@ export default {
})
},
videoStop () {
+ if (this.xg.fullscreen) {
+ this.xg.exitFullscreen()
+ }
this.xg.destroy()
this.config.src = ''
this.name = ''
this.right.list = []
this.showNext = false
- this.xg = new Hls(this.config)
+ setTimeout(() => {
+ this.playerInstall()
+ this.xg = new Hls(this.config)
+ this.bindEvent()
+ }, 500)
},
minMaxEvent () {
const win = remote.getCurrentWindow()
win.on('minimize', () => {
- if (this.xg) {
+ if (this.xg && this.xg.hasStart) {
this.xg.pause()
}
})
win.on('restore', () => {
- if (this.xg) {
+ if (this.xg && this.config.src) {
this.xg.play()
}
})
+ },
+ playerInstall () {
+ Player.install('playPrev', function () {
+ addPlayerBtn.bind(this, 'playPrev', '', { title: '上一集' })()
+ })
+ 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: '播放列表' })()
+ })
+ Player.install('showHistory', function () {
+ addPlayerBtn.bind(this, 'showHistory', '', { title: '播放历史' })()
+ })
+ const that = this
+ Player.install('videoTitle', function () {
+ let title
+ if (that.right.list.length > 1) {
+ title = `『第 ${that.video.info.index + 1} 集』${that.name}`
+ } else {
+ title = `${that.name}`
+ }
+ addPlayerView.bind(this, 'videoTitle', `${title}`, {})()
+ })
}
},
created () {
@@ -1045,32 +1078,7 @@ export default {
this.mtEvent()
},
mounted () {
- Player.install('playPrev', function () {
- addPlayerBtn.bind(this, 'playPrev', '', { title: '上一集' })()
- })
- 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: '播放列表' })()
- })
- Player.install('showHistory', function () {
- addPlayerBtn.bind(this, 'showHistory', '', { title: '播放历史' })()
- })
- const that = this
- Player.install('videoTitle', function () {
- let title
- if (that.right.list.length > 1) {
- title = `『第 ${that.video.info.index + 1} 集』${that.name}`
- } else {
- title = `${that.name}`
- }
- addPlayerView.bind(this, 'videoTitle', `${title}`, {})()
- })
-
+ this.playerInstall()
this.xg = new Hls(this.config)
ipcRenderer.on('miniClosed', () => {
history.find({ site: this.video.key, ids: this.video.info.id }).then(res => {