Redth / ZXing.Net.Maui

Barcode Scanning for MAUI?
MIT License
474 stars 150 forks source link

Android camera black screen #67

Open Martinchr82 opened 2 years ago

Martinchr82 commented 2 years ago

When I first arrive to the Page with the QR scanning, everything is working perfectly. I can also navigate to another page and come back to successfully scan again. But if I navigate to another page from a bottom tab and come back to the page, then the camera screen is black on Android (Samsung S8, OS 9). Everything is working on iOS

The project is created with VS 2022 Preview 17.4.0 Preview 4.0, using net. 6

https://github.com/Martinchr82/MauiQRScanning.git

ggamez4 commented 1 year ago

I am having the same issue with this only on Android. Only when scanning QR Codes, when scanning any other type of barcode, this issue does not occur.

My project is running VS for Mac 2022 Preview 17.5 Preview 1, using .NET 7

Phenek commented 1 year ago

I am experiencing a similar issue, on a modal page, on a real device. On simulator I can see the virtualize camera perfectly.

programatix commented 1 year ago

I'm having this issue when the CameraBarcodeReaderView is placed inside a page as an AppShell TabBar page. Upon navigating out from the page with CameraBarcodeReaderView and back, the view is black.

The workaround is to switch to rear camera and back to front (and vice versa). I think it has something to do with the camera initialization. It would be great if we could manually stop and start the camera.

Actually this happen to https://github.com/JimmyPun610/BarcodeScanner.Mobile.

a7son commented 1 year ago

I am experiencing a similar issue, on real device with tabbedpage as my main page.. when i go back to barcode page, it goes black screen.. i should go back to my login page and relogin, and the trouble was gone.. Im using .NET 7

golovko commented 1 year ago

Same issue. Found a kinda workaround, re-initializing the camera by switching front/rear cameras: protected override async void OnAppearing() { cameraBarcodeReaderView.CameraLocation = CameraLocation.Front; cameraBarcodeReaderView.CameraLocation = CameraLocation.Rear; }

Quaybe commented 1 year ago

The workaround is to switch to rear camera and back to front (and vice versa). I think it has something to do with the camera initialization. It would be great if we could manually stop and start the camera.

Actually this happen to https://github.com/JimmyPun610/BarcodeScanner.Mobile.

Completely agree, there would be a lot of value added to being able to manually start and stop the camera. I'm trying to have the camera become visible in the same view as my other controls, over the top of them. But even if I have IsVisible=False IsEnabled=False, the camera is still active when the page loads, and I'm still prompted for permissions even though I'm not trying to use the camera just yet.

BarcodeScanner.Mobile seems promising but doesn't support .NET 7 it seems

Yo0oo0oY commented 8 months ago

The solution to the issue of the screen turning black after the phone is locked and unlocked again.