最近刚开发好一个企业内部使用的小程序,用了camera做人脸截取,但是部分手机调起camera时出现黑屏现象,两台iphone11,一台ios13.4.1正常,一台ios13.5.2一开始正常,后来出现黑屏且一直无法调起前置,手机相机没问题,还有vivo iqoo偶尔会出现黑屏现象;
<zan-pop type="bottom" show="{{camera_show}}" bindclose="togglePopup">
<view class="camera content">
<camera device-position="front" flash="off" binderror="error" style="width: 100vw; height: {{camera_h}};z-index:0" wx:if="{{camera_show}}">camera>
<cover-view class="mc_wrap">
<cover-image class="w-p100 h-p100" src="../../common/images/camera_bg.png">cover-image>
<cover-view class="tips c-white txt-c h5">请调整人脸角度后点击下方按钮cover-view>
cover-view>
<cover-view class="camera_wrap">
<cover-view class="camera_btn_wrap flex flex-c" bindtap="takePhoto">
<cover-view class="camera_btn h4 c-5 flex flex-c" hover-class="take">cover-view>
cover-view>
cover-view>
<cover-view class="close" bindtap="togglePopup">
<cover-image src="../../common/images/close.png">cover-image>
cover-view>
view>
zan-pop>
let camera_show = this.data.camera_show,
that = this;
wx.getSetting({
success(res) {
console.log(res)
if (res.authSetting['scope.camera'] != undefined && !res.authSetting['scope.camera']) { //非初始化进入该页面,且未授权
wx.showModal({
title: '是否授权摄像头功能功能',
content: '需要授权使用摄像头功能,请确认授权,否则无法使用',
success: function (res) {
if (res.cancel) {
wx.showToast({
title: '授权失败',
icon: 'none',
duration: 1000
})
} else if (res.confirm) {
wx.openSetting({
success: function (dataAu) {
if (dataAu.authSetting["scope.camera"]) {
wx.showToast({
title: '授权成功',
icon: 'success',
duration: 1000
})
that.setData({
camera_show: true
})
} else {
wx.showToast({
title: '授权失败',
icon: 'none',
duration: 1000
})
}
}
})
}
}
})
} else {
that.setData({
camera_show: !camera_show
})
}
}
})
你好,麻烦具体描述问题流程,提供对应机型的微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html