Skip to content

Conversation

@bakai-dev-team
Copy link

Pull request checklist

Please check if your PR fulfills the following requirements:

  • The changes have been tested successfully.
  • A changeset has been created (npm run changeset).
  • I have read and followed the pull request guidelines.

@matthiasschwarz
Copy link

Is this pull request related to #298?
If this is the case, this implementation would, at least for Android and the web, only pause and resume the barcode scan, but not freeze the camera preview.

@bakai-dev-team
Copy link
Author

Is this pull request related to #298? If this is the case, this implementation would, at least for Android and the web, only pause and resume the barcode scan, but not freeze the camera preview.

Partially it resolves #298 too. We didn't test web version.

On Android

if pauseScan called it will skip all scanned results (will not resolve call) until resumeScan called

public void analyze(@NonNull ImageProxy imageProxy) {
        if (isPaused) {
            imageProxy.close();
            return;
        }
        ....
}

On iOS

It fill stop capture session (freeze) until resumeScan called

DispatchQueue.main.async {
          if let session = self.cameraView?.getCaptureSession() {
              if session.isRunning {
                  session.stopRunning()
              }
          }
}

@bakai-dev-team bakai-dev-team changed the title FEAT: Pause and Resume Scan on CAP 7 feat(barcode-scanning): pause and resume scan feature, cap 7 Sep 9, 2025
@robingenz
Copy link
Member

robingenz commented Sep 9, 2025

@bakai-dev-team It should freeze the camera view. Otherwise, this feature is useless since you can do the same in the webview (just remove the listener).

@bakai-dev-team
Copy link
Author

@bakai-dev-team It should freeze the camera view. Otherwise, this feature is useless since you can do the same in the webview (just remove the listener).

On IOS it's already behaves as you mentioned.

How can we do the same on Android?

@robingenz
Copy link
Member

@bakai-dev-team I haven't looked into it yet. It's part of the issue to find that out.

@bakai-dev-team
Copy link
Author

@robingenz All done as you required.

Anyone who can check and confirm that it is works, you are welcome.

@erlanz
Copy link

erlanz commented Nov 5, 2025

@robingenz HI, could you please check PR, thanks

@robingenz
Copy link
Member

PR is still failing.

@erlanz
Copy link

erlanz commented Dec 6, 2025

@robingenz Hello, fix lint, prettier. could you please check PR, thanks

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 6, 2025

Open in StackBlitz

@capacitor-mlkit/barcode-scanning

npm i https://pkg.pr.new/capawesome-team/capacitor-mlkit/@capacitor-mlkit/barcode-scanning@300

@capacitor-mlkit/document-scanner

npm i https://pkg.pr.new/capawesome-team/capacitor-mlkit/@capacitor-mlkit/document-scanner@300

@capacitor-mlkit/face-detection

npm i https://pkg.pr.new/capawesome-team/capacitor-mlkit/@capacitor-mlkit/face-detection@300

@capacitor-mlkit/face-mesh-detection

npm i https://pkg.pr.new/capawesome-team/capacitor-mlkit/@capacitor-mlkit/face-mesh-detection@300

@capacitor-mlkit/selfie-segmentation

npm i https://pkg.pr.new/capawesome-team/capacitor-mlkit/@capacitor-mlkit/selfie-segmentation@300

@capacitor-mlkit/subject-segmentation

npm i https://pkg.pr.new/capawesome-team/capacitor-mlkit/@capacitor-mlkit/subject-segmentation@300

@capacitor-mlkit/translation

npm i https://pkg.pr.new/capawesome-team/capacitor-mlkit/@capacitor-mlkit/translation@300

commit: aa3b0a0

@erlanz
Copy link

erlanz commented Dec 10, 2025

@robingenz Hello, fix lint, prettier. could you please check PR, thanks

Copy link
Member

@robingenz robingenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested your implementation on all platforms?

/**
* Pause scanning for barcodes.
*
* @since 7.3.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 7.3.1
* @since 7.5.0

If we manage to release it this week, it would be version 7.5.0.

/**
* Resume scanning for barcodes.
*
* @since 7.3.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 7.3.1
* @since 7.5.0

If we manage to release it this week, it would be version 7.5.0.

Comment on lines +103 to +108
if (!this.videoElement) {
throw new Error(this.errorVideoElementMissing);
}
if (!this.stream) {
throw new Error('Stream is not available, call startScan first.');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin should behave the same on all platforms. It should either return an error on Android or iOS as well, or on none on all platforms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bakai-dev-team This is still open.

/**
* Pause scanning for barcodes.
*
* @since 7.5.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 7.5.0
* @since 8.1.0

Next version will be 8.1.0.

/**
* Resume scanning for barcodes.
*
* @since 7.5.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 7.5.0
* @since 8.1.0

"strict": true,
"target": "es2017"
"target": "es2017",
"types": []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert that change. It's not related to this feature. You may need to install the latest version of @types/node as dev dependency if you have type issues.


async isSupported(): Promise<IsSupportedResult> {
return { supported: this._isSupported };
return {supported: this._isSupported};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format the code correctly and run npm run fmt.

Comment on lines +103 to +108
if (!this.videoElement) {
throw new Error(this.errorVideoElementMissing);
}
if (!this.stream) {
throw new Error('Stream is not available, call startScan first.');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bakai-dev-team This is still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants