Code Monkey home page Code Monkey logo

Comments (9)

pvasa avatar pvasa commented on June 7, 2024 1

@iulian0512 in your layout file, either width or height should be wrap_content.

from cameraview-ex.

yangchendev avatar yangchendev commented on June 7, 2024

@pvasa

from cameraview-ex.

pvasa avatar pvasa commented on June 7, 2024

@yangchendev this seems to be like device specific issue. Have you tried running sample app on the same device?

from cameraview-ex.

rubensim avatar rubensim commented on June 7, 2024

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.

pvasa avatar pvasa commented on June 7, 2024

@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.

iulian0512 avatar iulian0512 commented on June 7, 2024

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.

stale avatar stale commented on June 7, 2024

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.

stale avatar stale commented on June 7, 2024

Closed due to inactivity.

from cameraview-ex.

rocca23 avatar rocca23 commented on June 7, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.