正解:因为IOS和安卓的生态差别,IOS在渲染时会直接把相机组件渲染出来,调取相应原生语句比安卓端要快,因此结果就是安卓端在渲染相机时不能同步进行,我在加了一个延时器后,各个模块就能正常运行了。ps:吐槽一下,回复太慢了,还是得靠自己。
安卓真机Camera,startRecord走错误回调相机尚未初始化?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, }) } }) },
2020-05-16楼主搞定了吗?我现在遇到了只在安卓端有这种情况。
真机拍照报错,提示相机未初始化安卓真机拍照时报错,开发者工具模拟正常。 operateCamera:fail camera has not been initialized 手机:荣耀10,安卓9,EMUI版本 9.1.0
2020-05-15