takePhoto间隔设置为10ms, 导致无法complete
- 当前 Bug 的表现(可附上截图)
takePhoto() 间隔10ms, 几次调用之后无法complete, complete回调函数不被调用。
- 预期表现
预期可以complete
- 复现路径
按照代码复现。
- 提供一个最简复现 Demo
captureTimer: function() { const self = this; setTimeout(() => { if (self.nextCaptureFlag && Date.now() >= 10 * 1 + self.lasttime) { self.nextCaptureFlag = false; self.addLog('start'); self.takePhotoForDetection(); self.lasttime = Date.now(); } self.captureTimer(); }, 10);},takePhotoForDetection() { const self = this; self.addLog('before take photo'); let cameraCtx = wx.createCameraContext(); cameraCtx.takePhoto({ quality: 'low', success: (res) => { self.addLog('take photo'); }, complete: (ddd) => { self.addLog(`complete`); self.nextCaptureFlag = true; }, fail: (err) => { self.addLog(`err`); }, });}, |
