capacitor-mlkit icon indicating copy to clipboard operation
capacitor-mlkit copied to clipboard

bug: Rotating from portrait to landscape breaks scanner on ipad

Open mbrunneritlabs opened this issue 1 year ago • 3 comments

Plugin(s)

  • [X] Barcode Scanning
  • [ ] Face Detection
  • [ ] Face Mesh Detection
  • [ ] Selfie Segmentation
  • [ ] Translation

Version

6.1.0

Platform(s)

  • [ ] Android
  • [X] iOS
  • [ ] Web

Current behavior

On most devices when opening the barcode scanner in portrait mode and then turning to landscape mode the picture in the scanner window turns correctly.

On Ipad10 when turning the barcode scanner window from portrait to landscape the picture doesnt turn and the window is cut on the right side.

So our app itself and the overlay turns correctly to landscape mode but the scanner stays in portrait mode.

// Portrait Mode

Image

// Broken Landscape Mode after rotating

Image

Interesting:

Starting the scanner in landscape mode works correctly. The issue only occurs when turning the scanner from portrait to landscape while running and only on our ipad test device.

Expected behavior

When turning to landscape mode the scanner turns correctly on ipad.

Reproduction

The bug lies withing the scanner itself

Steps to reproduce

Run BarcodeScanner.startScan on Ipad 10 Turn from Portrait Mode to Landscape -> The picture from camera is rotated incorrectly and black bar occurs.

Other information

No response

Capacitor doctor

I currently cannot run this command but can provide the next days.

Before submitting

  • [X] I have read and followed the bug report guidelines.
  • [X] I have attached links to possibly related issues and discussions.
  • [X] I understand that incomplete issues (e.g. without reproduction) are closed.

mbrunneritlabs avatar Jul 17 '24 14:07 mbrunneritlabs

Unfortunately, I don't have access to an iPad 10. Feel free to create a PR.

robingenz avatar Jul 17 '24 15:07 robingenz

are we progressing in this?

orl99 avatar Aug 07 '24 23:08 orl99

We found a semi good workaround. We listen to the screen rotate event and restart the scanner manually.

mbrunneritlabs avatar Aug 08 '24 06:08 mbrunneritlabs

Hi @robingenz we are also facing the same issue in ipad devices, we tried workaround but that is causing some camera glitchi, it is not working as expected. please find the below workaround code.

setTimeout(() => {
	ScreenOrientation.addListener('screenOrientationChange', (res: ScreenOrientation) => {
		this.ngZone.run(() => {
			this.screenOrientationTypeChange = res?.type;
			if (this.screenOrientationTypeChange === 'landscape-primary' ||
				this.screenOrientationTypeChange === 'landscape-secondary' ){
					console.log('start scanner');
					this.startScanner().catch(() => {});
			}
		});
	});
}, 100);

Is there any plan to fix this issue for upcoming releases?

anusha-kaparapu avatar Feb 13 '25 10:02 anusha-kaparapu

This is fixed in the latest version, see https://github.com/capawesome-team/capacitor-mlkit/commit/dd12ea8b8f5906f0ab56f3c1672d09e5a48426bb.

robingenz avatar Feb 13 '25 10:02 robingenz

Hi @robingenz i am not seeing these commit changes in latest 7.0.0 version for below change log

https://github.com/capawesome-team/capacitor-mlkit/commit/dd12ea8b8f5906f0ab56f3c1672d09e5a48426bb

i installed latest version and tested in fix, but unfortunately it is not working, same issue has been reproduced, please confirm me once.

Note: This fix is working in 7.0.0-next.3 version

Is there anything is missing in 7.0.0 version?

anusha-kaparapu avatar Feb 17 '25 09:02 anusha-kaparapu

@anusha-kaparapu Yes, you're right. Something went wrong with the merge. I have created a new PR: #248. Thanks for letting me know!

robingenz avatar Feb 17 '25 09:02 robingenz

Thanks for quick response @robingenz , when can we expect these changes in latest 7.0.0 version as we are moving to production soon. i have one more dought according to the document, the capacitor core should be 7, but we are only utilising 6 because of project requirements. We used the following command to force the package upgrade.

  1. npm install @capacitor-mlkit/[email protected] —force
  2. Will there be any problems pushing to app stores or will there be any issues with the packages I forced to update?

anusha-kaparapu avatar Feb 17 '25 09:02 anusha-kaparapu

@anusha-kaparapu

when can we expect these changes in latest 7.0.0 version as we are moving to production soon.

We plan to publish a new release this week.

Will there be any problems pushing to app stores or will there be any issues with the packages I forced to update?

I can't answer that as I have never tested this combination.

robingenz avatar Feb 17 '25 10:02 robingenz

Thanks @robingenz

anusha-kaparapu avatar Feb 17 '25 10:02 anusha-kaparapu

Hi @robingenz we have upgraded to latest 7 version of barcode scanner and try to build an archive my app in xcode and try to export privacy report.

Image

but still im getting below report

Image

but i got below email from Apple store

Image

inorder to cross verify I uninstalled barcode-scanner then my privacy report is empty(no issues). im confuse here, how to solve both issues please guide me on it

anusha-kaparapu avatar Feb 19 '25 09:02 anusha-kaparapu

@robingenz when can we expect these commit changes https://github.com/capawesome-team/capacitor-mlkit/pull/248, as we are close to our production release.

anusha-kaparapu avatar Feb 28 '25 05:02 anusha-kaparapu

@anusha-kaparapu We will publish the next release today.

robingenz avatar Feb 28 '25 06:02 robingenz

Thanks @robingenz

anusha-kaparapu avatar Feb 28 '25 06:02 anusha-kaparapu