Fix:2889 【商城小程序】优化当寻趣味店铺封面为视频时,视频资讯和视频封面不能同时播放

This commit is contained in:
modendeveloper
2024-12-18 23:18:12 +08:00
parent f174a83ac0
commit f64f87546e
+23 -3
View File
@@ -31,6 +31,7 @@
:autoplay="true"
:controls="true"
:loop="false"
id="coverVideo"
object-fit="contain"
play-btn-position="center"
class="video"
@@ -232,8 +233,8 @@
controls
play-btn-position="center"
class="video-item"
:autoplay="inn.coverType !== 2"
@play="infoItemViewClick(item)"
:id="'video-item' + index"
@play="infoItemViewClick(item, index)"
/>
</view>
<view v-else>
@@ -666,7 +667,26 @@ export default {
infoClick: function (info) {
// this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + info.id)
},
infoItemViewClick(item) {
infoItemViewClick(item, index) {
if(item.type === 'NT_VIDEO') {
const coverCtx = uni.createVideoContext('coverVideo', this)
coverCtx.pause()
const playerId = 'video-item' + index
if(this.videoPlayers.includes(playerId)) {
this.videoPlayers.forEach(player => {
if(player === playerId) return
const playerCtx = uni.createVideoContext(player, this)
playerCtx.pause()
})
} {
this.videoPlayers.push(playerId)
this.videoPlayers.forEach(player => {
if(player === playerId) return
const playerCtx = uni.createVideoContext(player, this)
playerCtx.pause()
})
}
}
uni.$u.debounce(() => {
hotelNewsView({ id: item.id }).finally(() => {
this.infoArray.map(info => {