diff --git a/ohos/src/main/ets/MobileScannerPlugin.ets b/ohos/src/main/ets/MobileScannerPlugin.ets index 7063b925c507a9f97a226239832a317417ac44e3..37d7b32e2b3a3d6cd980a2b788b6e9048a858e94 100644 --- a/ohos/src/main/ets/MobileScannerPlugin.ets +++ b/ohos/src/main/ets/MobileScannerPlugin.ets @@ -288,7 +288,7 @@ export class MobileScannerPlugin implements FlutterPlugin, MethodCallHandler, Ab if (this.isStart) { customScan.rescan(); } - }, 1000) + }, 250) } // 返回相机帧的回调 private frameCallback: AsyncCallback = @@ -369,11 +369,15 @@ export class MobileScannerPlugin implements FlutterPlugin, MethodCallHandler, Ab } async stop(result: MethodResult) { - try { - await customScan.stop(); - await customScan.release() + if (this.isStart) { this.isStart = false; - } catch (e) { + try { + await customScan.stop(); + await customScan.release() + } catch (e) { + Log.e(TAG, "customScan Stop Error:" + JSON.stringify(error)); + this.isStart = true; + } } result.success(null) }