diff --git a/ohos/src/main/ets/MobileScannerPlugin.ets b/ohos/src/main/ets/MobileScannerPlugin.ets index 50b26a4b39de9dcc3236202ead8a3b66f512dc1d..7063b925c507a9f97a226239832a317417ac44e3 100644 --- a/ohos/src/main/ets/MobileScannerPlugin.ets +++ b/ohos/src/main/ets/MobileScannerPlugin.ets @@ -118,6 +118,8 @@ export class MobileScannerPlugin implements FlutterPlugin, MethodCallHandler, Ab this.eventChannel?.setStreamHandler(null); this.eventChannel = null; + this.isStart = false; + // unregisterTexture binding.getTextureRegistry().unregisterTexture(this.textureId); } @@ -283,7 +285,9 @@ export class MobileScannerPlugin implements FlutterPlugin, MethodCallHandler, Ab }); this.callback(_r, this.imageBuffer, this.cameraWidth, this.cameraHeight) setTimeout(() => { - customScan.rescan(); + if (this.isStart) { + customScan.rescan(); + } }, 1000) } // 返回相机帧的回调