扫描小程序码分享
如代码所示,video组件包含camera组件时,调用VideoContext.requestFullScreen()API,视频全屏后camera调用的相机未旋转。
设备:小米13
安卓版本号:Xiaomi HyperOS 2.0.203.0/Android 15
截图:首先我的手一直和手机是一个方向的,但全屏后camera方向未旋转,IOS是正常的
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
微信更新一下试试,我这边8.0.62正常
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
<video id="myVideo" src="{{videoUrl}}" autoplay="{{true}}" :controls="{{false}}"> <camera flash="off" frame-size="small" resolution="low" device-position="front" binderror="error" style="width: 100px; height: 100px;"></camera> <button bind:tap="onQuit">退出全屏</button> </video> <button bind:tap="onRotate">旋转</button> <view>方向:{{ deviceOrientation }}</view>
// index.js Page({ data: { deviceOrientation: 'portrait', videoUrl: "https://hjblm-platform.chard.org.cn/digital_interven/video/2025/08/BAD2ZX_1754893880206.mp4", }, onRotate() { this.videoContext = wx.createVideoContext('myVideo'); this.videoContext.requestFullScreen({ direction: 90, }); this.setData({ deviceOrientation: this.data.deviceOrientation === 'portrait' ? 'landscape' : 'portrait' }) }, onQuit() { this.videoContext = wx.createVideoContext('myVideo'); this.videoContext.exitFullScreen(); } })
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
微信更新一下试试,我这边8.0.62正常
<video id="myVideo" src="{{videoUrl}}" autoplay="{{true}}" :controls="{{false}}"> <camera flash="off" frame-size="small" resolution="low" device-position="front" binderror="error" style="width: 100px; height: 100px;"></camera> <button bind:tap="onQuit">退出全屏</button> </video> <button bind:tap="onRotate">旋转</button> <view>方向:{{ deviceOrientation }}</view>// index.js Page({ data: { deviceOrientation: 'portrait', videoUrl: "https://hjblm-platform.chard.org.cn/digital_interven/video/2025/08/BAD2ZX_1754893880206.mp4", }, onRotate() { this.videoContext = wx.createVideoContext('myVideo'); this.videoContext.requestFullScreen({ direction: 90, }); this.setData({ deviceOrientation: this.data.deviceOrientation === 'portrait' ? 'landscape' : 'portrait' }) }, onQuit() { this.videoContext = wx.createVideoContext('myVideo'); this.videoContext.exitFullScreen(); } })