收藏
回答

自定义tabbar时,video组件requestFullScreen不能全屏,但是有声音?


<template>
  <video v-if="showVideo" id="myVideo" :autoplay="true"  controls  @fullscreenchange="fullScreenChange"  :show-fullscreen-btn="false"
      :src="videoUrl"></video>
</template>
<script setup>
  const showVideo = ref(false)
  const videoContext = ref(null)
  const videoUrl = ref("")
  
  const jumpToDetail = (item) => {
      showVideo.value = true
      videoUrl.value = item.content
      videoContext.value = uni.createVideoContext('myVideo')
      // 默认全屏
      videoContext.value.requestFullScreen({
        direction:0
      })
  }
  const fullScreenChange = (e)=>{
    if(!e.detail.fullScreen){
      showVideo.value = false
    } 
}
</script>
回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容