bugfix: 修复视频切换播放方式无法自动播放的问题

pull/1234/head
xiaoQQya 2023-12-28 15:54:19 +08:00
parent a72ef2db8e
commit a2c27f2b7e
3 changed files with 4 additions and 15 deletions

View File

@ -44,7 +44,7 @@ export default {
vod: true, // vod: true, //
}; };
}, },
props: ['videoUrl', 'error', 'hasAudio', 'height', 'autoPlay'], props: ['videoUrl', 'error', 'hasAudio', 'height'],
mounted() { mounted() {
let paramUrl = decodeURIComponent(this.$route.params.url) let paramUrl = decodeURIComponent(this.$route.params.url)
this.$nextTick(() => { this.$nextTick(() => {
@ -56,9 +56,6 @@ export default {
this.videoUrl = paramUrl; this.videoUrl = paramUrl;
} }
this.btnDom = document.getElementById("buttonsBox"); this.btnDom = document.getElementById("buttonsBox");
if (this.autoPlay) {
this.play(this.videoUrl);
}
}) })
}, },
watch: { watch: {
@ -67,7 +64,8 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.play(val); this.play(val);
}) })
} },
immediate: true
} }
}, },
methods: { methods: {

View File

@ -453,15 +453,6 @@ export default {
playFromStreamInfo: function (realHasAudio, streamInfo) { playFromStreamInfo: function (realHasAudio, streamInfo) {
this.showVideoDialog = true; this.showVideoDialog = true;
this.hasaudio = realHasAudio && this.hasaudio; this.hasaudio = realHasAudio && this.hasaudio;
if (this.$refs[this.activePlayer]) {
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('关闭视频');

View File

@ -18,7 +18,7 @@
@click="playerIdx = (i-1)"> @click="playerIdx = (i-1)">
<div v-if="!videoUrl[i-1]" style="color: #ffffff;font-size: 30px;font-weight: bold;">{{ i }}</div> <div v-if="!videoUrl[i-1]" style="color: #ffffff;font-size: 30px;font-weight: bold;">{{ i }}</div>
<player ref="player" v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot" <player ref="player" v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot"
@destroy="destroy" :auto-play="true"/> @destroy="destroy"/>
</div> </div>
</div> </div>
</el-main> </el-main>