Comments (9)
@iulian0512 in your layout file, either width or height should be wrap_content
.
from cameraview-ex.
from cameraview-ex.
@yangchendev this seems to be like device specific issue. Have you tried running sample app on the same device?
from cameraview-ex.
Hi @pvasa , I got the same issue, on Pixel API 27 1080x1920:420dpi (Android 8.1 Google play) x86 emulator.
com.priyankvasa.android.cameraviewex.CameraViewException: Error opening camera with id 0 (error: 4)
at com.priyankvasa.android.cameraviewex.Camera2$cameraDeviceCallback$2$1.onError(Camera2.kt:149)
at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.notifyError(CameraDeviceImpl.java:1929)
at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.lambda$Sm85frAzwGZVMAK-NE_gwckYXVQ(Unknown Source:0)
at android.hardware.camera2.impl.-$$Lambda$CameraDeviceImpl$CameraDeviceCallbacks$Sm85frAzwGZVMAK-NE_gwckYXVQ.accept(Unknown Source:8)
at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:258)
at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:182)
at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:77)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:65)
The error: 4 is the ERROR_CAMERA_DEVICE, please look here for more details.
I tried running Sample app as well, and got another exception:
com.priyankvasa.android.cameraviewex.debug E/CameraCaptureSession: Session 0: Exception while stopping repeating:
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2188)
at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:988)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:394)
at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:574)
at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:233)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
You can find more info here
Could you please have a look and let me know if this is related to cameraview-ex and some fix should be done.
from cameraview-ex.
@rubensim the issues that you're seeing are because of using the lib on an emulator. The lib does not support emulator.
from cameraview-ex.
i have this issue on Galaxy S8 Android 9
Fatal Exception: com.priyankvasa.android.cameraviewex.CameraViewException: Error opening camera with id 0 (error: 3) at com.priyankvasa.android.cameraviewex.Camera2$cameraDeviceCallback$2$1.onError + 145(Camera2.kt:145) at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.notifyError + 1929(CameraDeviceImpl.java:1929) at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.lambda$Sm85frAzwGZVMAK-NE_gwckYXVQ(Unknown Source) at android.hardware.camera2.impl.-$$Lambda$CameraDeviceImpl$CameraDeviceCallbacks$Sm85frAzwGZVMAK-NE_gwckYXVQ.accept + 8(Unknown Source:8) at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke + 258(PooledLambdaImpl.java:258) at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke + 182(PooledLambdaImpl.java:182) at com.android.internal.util.function.pooled.OmniFunction.run + 77(OmniFunction.java:77) at android.os.Handler.handleCallback + 873(Handler.java:873) at android.os.Handler.dispatchMessage + 99(Handler.java:99) at android.os.Looper.loop + 214(Looper.java:214) at android.os.HandlerThread.run + 65(HandlerThread.java:65)
layout file:
`
<com.priyankvasa.android.cameraviewex.CameraView
android:id="@+id/fragpvocrcamera"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:keepScreenOn="true"
app:aspectRatio="4:3"
app:autoFocus="continuous_picture"
app:awb="auto"
app:cameraMode="continuous_frame|single_capture"
app:facing="back"
app:flash="auto"
app:jpegQuality="high"
app:noiseReduction="high_quality"
app:opticalStabilization="true"
app:outputFormat="jpeg"
app:pinchToZoom="false"
app:shutter="short_time"
app:touchToFocus="false"
app:zsl="true" />
thanks for your effort to provide us with a simple & easy to use camera library.
from cameraview-ex.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from cameraview-ex.
Closed due to inactivity.
from cameraview-ex.
I've had some reports about this issue, devices are Samsung Galaxy A20e and Galaxy A40, both with Android 9. The OS version seems to be the common factor. In my case I had also errors with device id = 1, but always error code 4 (ERROR_CAMERA_DEVICE). The current workaround is to use cameraView.addCameraErrorListener
to handle the error in a non-fatal way.
Edit1: Also, this started happening after updating from version 2.3.0 to version 3.4.3.
Edit2: I am starting the cameraView with facing = FRONT, and I get this error for camera id 0, which is the rear camera. In fact, the preview for the front camera (id 1) actually starts fine. Moreover, if I switch to rear camera, it works fine. In my case it seems it tries to start both front and rear camera, with the result that the front camera runs fine and an error is thrown for the rear camera.
from cameraview-ex.
Related Issues (20)
- in android 6.0 not working HOT 2
- Camera.isVideoRecording always returns false HOT 2
- hi? HOT 2
- error: expected enum but got (raw string) single_capture. HOT 2
- Caused by kotlin.UninitializedPropertyAccessException HOT 2
- UnsupportedOperationException No supported camera found for facing 1 HOT 2
- CameraCaptureSession: Session 1: Failed to create capture session; configuration failed HOT 2
- Samsung J7 prime issue in video recording, video recording stops just after starting. HOT 2
- no preview on pixel and samsung moblie HOT 2
- manual focus HOT 2
- Method markState must be called on the main thread HOT 5
- Preview is stretched for every aspect ratio if I use full screen CameraView HOT 2
- Front Faceing HOT 2
- expected enum but got (raw string) single_capture. HOT 2
- in android 6.0 not working HOT 2
- Method markState must be called on the main thread HOT 2
- Camera not working on Android 12 HOT 2
- Error when building APK HOT 2
- Android 11 and 12 I'm facing some issue HOT 2
- Unable to start video recording. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cameraview-ex.