openVideo () {
let timer = 4
this.showprocess = true
this.showcamera = true
this.ctx = wx.createCameraContext();
this.ctx.startRecord({
success: (res) => {
console.log(res,"开始拍摄")
let clearTimer = setInterval(() => {
timer--;
if (timer < 0) {
this.closeVideo()
clearInterval(clearTimer)
}
}, 1000)
},
fail:(res) => {
console.log(res,"错误回调")
wx.showToast({
title: '相机尚未初始化,请重新授权',
icon: 'none',
duration: 2000,
})
}
})
},
正解:因为IOS和安卓的生态差别,IOS在渲染时会直接把相机组件渲染出来,调取相应原生语句比安卓端要快,因此结果就是安卓端在渲染相机时不能同步进行,我在加了一个延时器后,各个模块就能正常运行了。ps:吐槽一下,回复太慢了,还是得靠自己。
你好,你看下res具体返回什么内容咯