Fix:2959 【商城小程序】先播放古镇活动版块视频,再播放主图视频,活动版块视频不会暂停

This commit is contained in:
linxi
2024-12-27 17:06:24 +08:00
parent 71aa5e5a3c
commit cc2664f116
2 changed files with 11 additions and 1 deletions
+6
View File
@@ -108,6 +108,12 @@ export default {
playerCtx.pause() playerCtx.pause()
}) })
}, },
handlePlayer() {
this.videoPlayers.forEach(player => {
const playerCtx = uni.createVideoContext(player, this)
playerCtx.pause()
})
},
infoItemViewClick(item, index) { infoItemViewClick(item, index) {
if(item.contentType === 2) { if(item.contentType === 2) {
// const coverCtx = uni.createVideoContext('coverVideo', this) // const coverCtx = uni.createVideoContext('coverVideo', this)
+5 -1
View File
@@ -11,6 +11,7 @@
autoplay autoplay
play-btn-position="center" play-btn-position="center"
:show-fullscreen-btn="false" :show-fullscreen-btn="false"
@play="handlePlay"
> </video> > </video>
</view> </view>
<view class="top-intro"> <view class="top-intro">
@@ -39,7 +40,7 @@
<culture :list="townInfo.cultureInfo.cultureImages"></culture> <culture :list="townInfo.cultureInfo.cultureImages"></culture>
</view> </view>
<view v-if="actived === 3"> <view v-if="actived === 3">
<information :infoArray="activeties" @video="handleVideo"></information> <information ref="information" :infoArray="activeties" @video="handleVideo"></information>
</view> </view>
<view v-if="actived === 4"> <view v-if="actived === 4">
<service :info="{...townInfo.serviceInfo, name: townInfo.name}"></service> <service :info="{...townInfo.serviceInfo, name: townInfo.name}"></service>
@@ -114,6 +115,9 @@ export default {
this.getActive() this.getActive()
}, },
methods: { methods: {
handlePlay() {
this.$refs.information.handlePlayer()
},
handleVideo() { handleVideo() {
const videoCtx = uni.createVideoContext('videoCover', this) const videoCtx = uni.createVideoContext('videoCover', this)
videoCtx.pause() videoCtx.pause()