Cameraview: Getting FATAL exception while coming back to fragment after captured video

Created on 8 Aug 2019  路  2Comments  路  Source: natario1/CameraView

In my app there is two fragment, In one fragment i am using cameraView to capture video , after video captured, i am replacing fragment to another fragment which playing recorded file, when i am pressing back button i am getting below exception

Process: com.samyotech.keymarket, PID: 26451
com.otaliastudios.cameraview.CameraException: java.lang.RuntimeException: Internal Camera1 error. 2
at com.otaliastudios.cameraview.engine.Camera1Engine.onError(Camera1Engine.java:92)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1342)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.RuntimeException: Internal Camera1 error. 2
at com.otaliastudios.cameraview.engine.Camera1Engine.onError(Camera1Engine.java:85)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1342)聽
at android.os.Handler.dispatchMessage(Handler.java:106)聽
at android.os.Looper.loop(Looper.java:193)聽
at android.os.HandlerThread.run(HandlerThread.java:65)聽
2019-08-08 09:25:07.398 26451-27694/com.samyotech.keymarket E/CameraEngine: uncaughtException: Got CameraException: com.otaliastudios.cameraview.CameraException: java.lang.RuntimeException: Internal Camera1 error. 2 on engine state: ENGINE_STATE_STARTED
com.otaliastudios.cameraview.CameraException: java.lang.RuntimeException: Internal Camera1 error. 2
at com.otaliastudios.cameraview.engine.Camera1Engine.onError(Camera1Engine.java:92)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1342)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.RuntimeException: Internal Camera1 error. 2
at com.otaliastudios.cameraview.engine.Camera1Engine.onError(Camera1Engine.java:85)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1342)聽
at android.os.Handler.dispatchMessage(Handler.java:106)聽
at android.os.Looper.loop(Looper.java:193)聽
at android.os.HandlerThread.run(HandlerThread.java:65)聽

  • CameraView version: 2.0.0-rc2

  • Device / Android version: Mi A1, API 28

question

Most helpful comment

Most likely you are not releasing the CameraView correctly in the first fragment. Make sure you are using setLifecycleOwner(getViewLifecycleOwner()) instead of setLifecycleOwner(this).

All 2 comments

Most likely you are not releasing the CameraView correctly in the first fragment. Make sure you are using setLifecycleOwner(getViewLifecycleOwner()) instead of setLifecycleOwner(this).

Yes after this it start working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gabriel-TheCode picture gabriel-TheCode  路  8Comments

therealshabi picture therealshabi  路  10Comments

VGJohn picture VGJohn  路  3Comments

filippodelfra picture filippodelfra  路  6Comments

Cutta picture Cutta  路  3Comments