Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZXingScannerView shows camera stream rotated by 90 degrees in some devices. How can I fix rotation? #1068

Open
AthanasiosKampylis opened this issue Feb 28, 2023 · 1 comment

Comments

@AthanasiosKampylis
Copy link

I use ZXingScannerView to scan a QR Code, but althought on many devices I have tested the camera works fine (both Portrait & Landscape), in one specific device the Video from camera stream is always rotated 90 degrees. I tried set "TryHarder" property to true or false, but nothing changes.

Here is a sample code.
In code behind I initialize ZXingScannerView:
private void InitializeBarcodeCameraView {
if (_viewModel != null) {
_scanView = new ZXingScannerView() {
IsScanning = true,
IsAnalyzing = true,
WidthRequest = 300,
IsVisible = true,
Options = _viewModel.UseBackCamera,
};
_scanView.OnScanResult += Camera_OnScanResult;
}
}

and at ViewModel I also initialize UseBackCamera property as follows:

UseBackCamera = new MobileBarcodeScanningOptions() {
UseFrontCameraIfAvailable = false,
};

where,
public MobileBarcodeScanningOptions UseBackCamera {
get { return _useBackCamera; }
set {
_useBackCamera = value;
RaisePropertyChanged(nameof(UseBackCamera));
}
}

I tried in code behind to set "Rotation" property for example 90 degrees with no result, as the only thing that rotates is ZXingScannerView and not the camera stream video itself.

Is there any "best practice" to set for example a property to force the rotation of video stream (in degrees) for the problematic specific device, without configuring the native library (I need to use the nuget package instead)?

@pachecosoftware
Copy link

We are also seeing this same issue on iOS devices. Would welcome a suggestion/fix for the issue.

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

No branches or pull requests

2 participants