const listener = context.onCameraFrame()的时候报如下错,导致listener没跑进去
(in promise) MiniProgramError
{"errMsg":"start:fail onCameraFrame is not supported on your device"}
基础版本:2.21.0,微信版本:8.0.16,手机型号:iPhone 12 pro,系统版本:iOS 15.0.2
wx.initFaceDetect({
success: res => {
console.log(res)
const context = wx.createCameraContext()
const listener = context.onCameraFrame((frame) => { //这里直接报错
console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height) //没有到这一步
wx.faceDetect({
frameBuffer: frame.data,
width: frame.width,
height: frame.height,
enablePoint: true,
enableConf: true,
enableAngle: true,
enableMultiFace: true,
success: (faceData) => {
console.log(faceData)
let face = faceData.faceInfo[0]
if (faceData.x == -1 || faceData.y == -1) {
this.tipsText = '检测不到人脸'
}
if (faceData.faceInfo.length > 1) {
this.tipsText = '请保证只有一人做认证'
} else {
if (face.angleArray.pitch >= 0.1 || face.angleArray.roll >= 0.1 || face.angleArray.yaw >= 0.1) {
this.tipsText = '请平视摄像头'
} else if (face.confArray.global <= 0.8 || face.confArray.leftEye <= 0.8 || face.confArray.mouth <= 0.8 || face.confArray.nose <= 0.8 || face.confArray.rightEye <= 0.8) {
this.tipsText = '请勿遮挡五官'
} else {
this.tipsText = '人脸认证成功'
// 这里可以写自己的逻辑了
}
}
},
fail: (err) => {
console.log(err)
if (err.x == -1 || err.y == -1) {
this.tipsText = '检测不到人脸'
} else {
this.tipsText = '网络错误,请退出页面重试'
}
}
})
})
listener.start()
},
fail: res => {
console.log(res)
}
})
都2023年了 怎么还没解决啊
-有测过其他设备吗,比如安卓的
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
代码片段:https://developers.weixin.qq.com/s/xYT6WSmJ75uN