调用摄像头的持续拍照出现无法定时拍照,闪退,发热等问题
发布于 6 年前 作者 lei01 12075 次浏览 来自 问答
  • 小程序Camera组件调用摄像头持续自动拍照上传,

部分手机无法按照预期自动拍照(华为手机尤其明显),

而且2~3分钟后手机发烫,电量耗费严重。

这个takePhoto方法会将照片上传到服务器,服务器返回信息后继续拍照,但有时候拍照很随缘,takePhoto后并没有拍照

//拍照功能
  takePhoto() {
    this.ctx.takePhoto({
      quality: 'low',
      success: (res) => {
        this.setData({
          tempSrc: res.tempImagePath
        })
        this.setData({
          tempImg: res.tempImagePath,
        })
        this.uploadImg(res.tempImagePath);
      }
    });
  },
回到顶部