mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-07-01 00:56:12 +08:00
支持播放器内播放直播
This commit is contained in:
@@ -96,6 +96,14 @@ export default {
|
||||
},
|
||||
setting () {
|
||||
return this.$store.getters.getSetting
|
||||
},
|
||||
video: {
|
||||
get () {
|
||||
return this.$store.getters.getVideo
|
||||
},
|
||||
set (val) {
|
||||
this.SET_VIDEO(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -106,19 +114,8 @@ export default {
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE']),
|
||||
playEvent (e) {
|
||||
var m3u8Link = e.url
|
||||
const fs = require('fs')
|
||||
var externalPlayer = this.setting.externalPlayer
|
||||
if (!fs.existsSync(externalPlayer)) {
|
||||
this.$message.error('请设置第三方播放器路径')
|
||||
// 在线播放该视频
|
||||
var link = 'https://www.m3u8play.com/?play=' + m3u8Link
|
||||
const open = require('open')
|
||||
open(link)
|
||||
} else {
|
||||
var exec = require('child_process').execFile
|
||||
exec(externalPlayer, [m3u8Link])
|
||||
}
|
||||
this.video = { info: { url: e.url } }
|
||||
this.view = 'Play'
|
||||
},
|
||||
removeEvent (e) {
|
||||
iptv.remove(e.id).then(res => {
|
||||
|
||||
@@ -297,17 +297,25 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
const index = this.video.info.index | 0
|
||||
let time = 0
|
||||
|
||||
history.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
if (res) {
|
||||
if (res.index === index) {
|
||||
time = res.time
|
||||
if (this.video.info.url) {
|
||||
this.playUrl(this.video.info.url)
|
||||
} else {
|
||||
const index = this.video.info.index | 0
|
||||
let time = 0
|
||||
history.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
if (res) {
|
||||
if (res.index === index) {
|
||||
time = res.time
|
||||
}
|
||||
}
|
||||
}
|
||||
this.playVideo(index, time)
|
||||
})
|
||||
this.playVideo(index, time)
|
||||
})
|
||||
}
|
||||
},
|
||||
playUrl (url) {
|
||||
this.$message.success(url)
|
||||
this.xg.src = url
|
||||
this.xg.play()
|
||||
},
|
||||
playVideo (index = 0, time = 0) {
|
||||
this.fetchM3u8List().then(m3u8Arr => {
|
||||
|
||||
Reference in New Issue
Block a user