d***@163.com
d***@163.com
  • 发布:2021-10-29 18:05
  • 更新:2021-10-29 18:13
  • 阅读:807

【报Bug】 video组件,全屏播放后,界面上部与底部被遮挡。 image组件裁剪图片显示异常

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.2.9

手机系统: Android

手机系统版本号: Android 11

手机厂商: 华为

手机机型: p40

页面类型: nvue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

<template>
<view class="video-player">
<video id="chatVideo" v-if="src" :controls="controls" :show-center-play-btn="false" :show-fullscreen-btn="false" class="video" :src="src" @fullscreenchange="fullscreenchange"></video>
</view>
</template>

<script>
export default {
data() {
return {
src: '',
videoContext:null,
controls:false
}
},
onReady: function (res) {
//创建并返回 video 上下文 videoContext 对象 https://uniapp.dcloud.io/api/media/video-context?id=createvideocontext
this.videoContext = uni.createVideoContext('chatVideo')
},
onLoad() {
const eventChannel = this.$scope.eventChannel;
eventChannel.on('toVideoPlayer', (data)=> {
this.src = data.content
//如提示chatVideo未找到,请加大延时时间
setTimeout(()=>{
this.videoContext.requestFullScreen({direction:0})
this.videoContext.play()
},50)
})
},
methods: {
//视频进入和退出全屏时触发
fullscreenchange(e) {
if(!e.detail.fullScreen){
this.src = ''
uni.navigateBack({
delta:1
})
}else{
this.controls = true
}
}
}
}
</script>
<style scoped>
.video-player {
background-color: #000000;
flex: 1;
/ 预防video控制属性失效.播放按钮显示并且位置不正确问题 /
align-items: center;
justify-content: center;
}
</style>

操作步骤:

点击图片 => video页面 => 自动全屏播放

预期结果:

正常无遮挡

实际结果:

上下被遮挡并且首帧图展示

bug描述:

华为品牌手机只测过p40,vivo等其他品牌正常
!!!测试的p40系统是鸿蒙2.0

2021-10-29 18:05 负责人:DCloud_Android_zl 分享
已邀请:
d***@163.com

d***@163.com (作者)

<template>  
    <view class="video-player">  
        <video id="chatVideo" v-if="src" :controls="controls" :show-center-play-btn="false" :show-fullscreen-btn="false"  class="video" :src="src" @fullscreenchange="fullscreenchange"></video>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                src: '',  
                videoContext:null,  
                controls:false  
            }  
        },  
        onReady: function (res) {  
            //创建并返回 video 上下文 videoContext 对象 https://uniapp.dcloud.io/api/media/video-context?id=createvideocontext  
            this.videoContext = uni.createVideoContext('chatVideo')  
        },  
        onLoad() {  
            const eventChannel = this.$scope.eventChannel;  
            eventChannel.on('toVideoPlayer', (data)=> {  
                this.src = data.content  
                //如提示chatVideo未找到,请加大延时时间  
                setTimeout(()=>{  
                    this.videoContext.requestFullScreen({direction:0})  
                    this.videoContext.play()  
                },50)  
            })  
        },  
        methods: {  
            //视频进入和退出全屏时触发  
            fullscreenchange(e) {  
                if(!e.detail.fullScreen){  
                    this.src = ''  
                    uni.navigateBack({  
                        delta:1  
                    })  
                }else{  
                    this.controls = true  
                }  
            }  
        }  
    }  
</script>  
<style scoped>  
.video-player {  
    background-color: #000000;  
    flex: 1;  
    /* 预防video控制属性失效.播放按钮显示并且位置不正确问题 */  
    align-items: center;  
    justify-content: center;  
}  
</style>

该问题目前已经被锁定, 无法添加新回复