修复ios视频兼容性问题,改为同h5播放形式

This commit is contained in:
2025-01-17 17:36:09 +08:00
parent 48154cf82f
commit 6c4a6ea804
3 changed files with 81 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
<template>
<view class="item" @appear="appear" @disappear="disappear" @click.stop :style="{height:height+'px'}">
<view class="item" @appear="appear" @disappear="disappear" @click.stop :style="{height:height+'px'}" :key="index">
<video class="u-flex-1 video" :show-fullscreen-btn="false" @controlstoggle="controlstoggles" v-if="showVideo"
play-btn-position="center"
@@ -78,6 +78,10 @@
// #endif
const props = defineProps({
isAndriod:{
type: Boolean,
default: false
},
height:{
type:Number,
default:0
@@ -296,19 +300,18 @@
let video = null
function disappear() {
emits('disappear')
function disappear(e) {
emits('disappear',e)
if (video) {
video.pause()
}
}
const showVideo = computed(() => {
// #ifdef H5
return props.current === props.index && props.item.videoUrl
// #endif
// #ifdef APP
return props.nowIndex === props.index && props.item.videoUrl ?true :false
// #endif
if(props.isAndriod){
return props.nowIndex === props.index && props.item.videoUrl ?true :false
}else{
return props.current === props.index && props.item.videoUrl
}
})
onMounted(() => {
init()