Merge pull request #2167 from ym6009/master

修复通道列表页面不能播放的问题
This commit is contained in:
648540858 2026-06-10 16:57:09 +08:00 committed by GitHub
commit ab371e00df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,12 +20,14 @@
> >
<el-tab-pane label="Jessibuca" name="jessibuca"> <el-tab-pane label="Jessibuca" name="jessibuca">
<jessibucaPlayer <jessibucaPlayer
style="height: 22.5vw"
v-if="activePlayer === 'jessibuca'" v-if="activePlayer === 'jessibuca'"
ref="jessibuca" ref="jessibuca"
:visible.sync="showVideoDialog" :visible.sync="showVideoDialog"
:error="videoError" :error="videoError"
:message="videoError" :message="videoError"
:has-audio="hasAudio" :has-audio="hasAudio"
:show-button="true"
fluent fluent
autoplay autoplay
live live
@ -61,12 +63,14 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<jessibucaPlayer <jessibucaPlayer
style="height: 22.5vw"
v-if="Object.keys(this.player).length == 1 && this.player.jessibuca" v-if="Object.keys(this.player).length == 1 && this.player.jessibuca"
ref="jessibuca" ref="jessibuca"
:visible.sync="showVideoDialog" :visible.sync="showVideoDialog"
:error="videoError" :error="videoError"
:message="videoError" :message="videoError"
:has-audio="hasAudio" :has-audio="hasAudio"
:show-button="true"
fluent fluent
autoplay autoplay
live live
@ -455,6 +459,11 @@ export default {
this.activePlayer = tab.name this.activePlayer = tab.name
this.videoUrl = this.getUrlByStreamInfo() this.videoUrl = this.getUrlByStreamInfo()
console.log(this.videoUrl) console.log(this.videoUrl)
this.$nextTick(() => {
if (this.$refs[this.activePlayer]) {
this.$refs[this.activePlayer].play(this.videoUrl)
}
})
}, },
openDialog: function(tab, channelId, param) { openDialog: function(tab, channelId, param) {
if (this.showVideoDialog) { if (this.showVideoDialog) {
@ -493,32 +502,34 @@ export default {
this.streamId = streamInfo.stream this.streamId = streamInfo.stream
this.app = streamInfo.app this.app = streamInfo.app
this.mediaServerId = streamInfo.mediaServerId this.mediaServerId = streamInfo.mediaServerId
this.playFromStreamInfo(false, streamInfo) this.playFromStreamInfo(hasAudio, streamInfo)
}, },
getUrlByStreamInfo() { getUrlByStreamInfo(streamInfo) {
console.log(this.streamInfo) console.log(this.streamInfo)
let streamInfo = this.streamInfo let info = streamInfo || this.streamInfo
if (this.streamInfo.transcodeStream) { if (!info) {
streamInfo = this.streamInfo.transcodeStream return ''
} }
if (info.transcodeStream) {
info = info.transcodeStream
}
let videoUrl
if (location.protocol === 'https:') { if (location.protocol === 'https:') {
this.videoUrl = streamInfo[this.player[this.activePlayer][1]] videoUrl = info[this.player[this.activePlayer][1]]
} else { } else {
this.videoUrl = streamInfo[this.player[this.activePlayer][0]] videoUrl = info[this.player[this.activePlayer][0]]
} }
return this.videoUrl return videoUrl
}, },
playFromStreamInfo: function(realHasAudio, streamInfo) { playFromStreamInfo: function(realHasAudio, streamInfo) {
this.showVideoDialog = true this.showVideoDialog = true
this.hasaudio = realHasAudio && this.hasaudio this.hasAudio = realHasAudio !== undefined ? realHasAudio : this.hasAudio
this.$nextTick(() => {
if (this.$refs[this.activePlayer]) { if (this.$refs[this.activePlayer]) {
this.$refs[this.activePlayer].play(this.getUrlByStreamInfo(streamInfo)) this.$refs[this.activePlayer].play(this.getUrlByStreamInfo(streamInfo))
} else {
this.$nextTick(() => {
this.$refs[this.activePlayer].play(this.getUrlByStreamInfo(streamInfo))
})
} }
})
}, },
close: function() { close: function() {
console.log('关闭视频') console.log('关闭视频')