From 731de590f7deb6cab3d95f60296f80aee7e83283 Mon Sep 17 00:00:00 2001 From: laoguanyao <806103474@qq.com> Date: Tue, 24 Sep 2024 20:35:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BC=A9=E7=9F=AD=E8=BF=9E=E7=BB=AD?= =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=97=B6=E9=97=B4=E9=97=B4=E9=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laoguanyao <806103474@qq.com> --- ohos/src/main/ets/MobileScannerPlugin.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ohos/src/main/ets/MobileScannerPlugin.ets b/ohos/src/main/ets/MobileScannerPlugin.ets index 7063b92..8ded95f 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 = -- Gitee From 3a3537c0c04c5e2c743449d788bf065e697c2719 Mon Sep 17 00:00:00 2001 From: laoguanyao <806103474@qq.com> Date: Wed, 25 Sep 2024 08:41:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9A=82=E5=81=9C?= =?UTF-8?q?=E5=92=8C=E9=87=8A=E6=94=BE=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E6=9A=82=E5=81=9C=E5=92=8C=E9=80=80=E5=87=BA=E4=B8=A4?= =?UTF-8?q?=E7=A7=8D=E5=9C=BA=E6=99=AF=E5=87=BA=E7=8E=B0=E7=9A=84=E6=84=8F?= =?UTF-8?q?=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laoguanyao <806103474@qq.com> --- ohos/src/main/ets/MobileScannerPlugin.ets | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ohos/src/main/ets/MobileScannerPlugin.ets b/ohos/src/main/ets/MobileScannerPlugin.ets index 8ded95f..37d7b32 100644 --- a/ohos/src/main/ets/MobileScannerPlugin.ets +++ b/ohos/src/main/ets/MobileScannerPlugin.ets @@ -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) } -- Gitee