question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Black Screen, no Camera Preview

See original GitHub issue

Description of the problem:

When I am using the below code to access the barcode scanner camera then as in the below image, a black screen covers what should have been the camera instead. I have made sure that the camera permission is granted.

` <com.journeyapps.barcodescanner.DecoratedBarcodeView android:id=“@+id/scanner” android:layout_width=“match_parent” android:layout_height=“200dp” app:zxing_preview_scaling_strategy=“centerCrop” app:zxing_use_texture_view=“false” />

<com.journeyapps.barcodescanner.ViewfinderView
    android:id="@+id/zxing_viewfinder_view"
    android:layout_width="match_parent"
    android:layout_height="200dp" />

`

My need is to reduce the size of the scanning camera to a given size ex -> as in the figure, so if there is a way around that, then please mention that.

screenshot_20170522-230250

Which library version are you using? 3.5.0.

Logs:

05-23 00:37:34.082 3062-3103/com.raywenderlich.alltherages E/CameraInstance: Failed to open camera java.lang.RuntimeException: Fail to connect to camera service at android.hardware.Camera.<init>(Camera.java:568) at android.hardware.Camera.open(Camera.java:405) at com.google.zxing.client.android.camera.open.OpenCameraInterface.open(OpenCameraInterface.java:83) at com.journeyapps.barcodescanner.camera.CameraManager.open(CameraManager.java:138) at com.journeyapps.barcodescanner.camera.CameraInstance$3.run(CameraInstance.java:190) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
johndev8964commented, Jul 8, 2020

@Override protected void onResume() { super.onResume(); barcodeView.resume(); }

@Override protected void onPause() { super.onPause(); barcodeView.pause(); }

Please add this, you can open a camera view.

0reactions
alexvarboffincommented, Nov 7, 2022

!!! android:hardwareAccelerated=“true” !!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a Webcam That Is Displaying a Black Screen on ...
Restart your computer in Safe Mode. If you open your webcam in Safe Mode and it still displays a black screen, try updating...
Read more >
Black screen while recording (no preview) in Windows 10 ...
Using Windows 10 Camera, the webcam records, but you cannot preview or see what you are recording until you open the recorded file,...
Read more >
9 Ways to Fix Webcam Black Screen Issues on Windows PC
Open Skype and go to Tools and select Options. Webcam show black screen no audio · Now navigate to Video settings and click...
Read more >
Fix black screen and 'Display blanked' message in Live view ...
This happens when certain sectors are blanked in the camera configuration. Therefore, you have to remove the blanking: go to the tab ...
Read more >
Blank or black preview screen or “no frame rate” with Altair ...
We've had reports from customers of a black or blank preview screen, or “no frames in preview mode” particularly with the high-megapixel cameras....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found