Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent camera error #574

Open
oan001 opened this issue Mar 19, 2024 · 0 comments
Open

Concurrent camera error #574

oan001 opened this issue Mar 19, 2024 · 0 comments

Comments

@oan001
Copy link

oan001 commented Mar 19, 2024

I am getting this error when i call cameraProvider.getAvailableConcurrentCameraInfos(). I tested this on two devices it works fine on samsung note 10+ but gives this error on sony xperia 1 mark 3.

this is the code:

for (List<CameraInfo> cameraInfoList : cameraProvider.getAvailableConcurrentCameraInfos()) {
            for (CameraInfo cameraInfo : cameraInfoList) {
                if (cameraInfo.getLensFacing() == CameraSelector.LENS_FACING_FRONT) {
                    cameraSelectorPrimary = cameraInfo.getCameraSelector();
                } else if (cameraInfo.getLensFacing() == CameraSelector.LENS_FACING_BACK) {
                    cameraSelectorSecondary = cameraInfo.getCameraSelector();
                }
            }
            if (cameraSelectorPrimary == null || cameraSelectorSecondary == null) {
                // If either a primary or secondary selector wasn't found, reset both
                // to move on to the next list of CameraInfos.
                cameraSelectorPrimary = null;
                cameraSelectorSecondary = null;
            } else {
                // If both primary and secondary camera selectors were found, we can
                // conclude the search.
                break;
            }
        }

FATAL EXCEPTION: main
Process: com.rbsol.project.lucided, PID: 10937
java.lang.IllegalArgumentException: No camera can be find for id: 5
at androidx.camera.camera2.internal.concurrent.Camera2CameraCoordinator.lambda$createCameraSelectorById$0(Camera2CameraCoordinator.java:189)
at androidx.camera.camera2.internal.concurrent.Camera2CameraCoordinator$$ExternalSyntheticLambda0.filter(Unknown Source:2)
at androidx.camera.core.CameraSelector.filter(CameraSelector.java:128)
at androidx.camera.lifecycle.ProcessCameraProvider.getCameraInfoFromCameraSelector(ProcessCameraProvider.java:882)
at androidx.camera.lifecycle.ProcessCameraProvider.getAvailableConcurrentCameraInfos(ProcessCameraProvider.java:823)
at com.rbsol.project.Fragments.CameraXFragment.bindToLifecycleForConcurrentCamera(CameraXFragment.java:551)
at com.rbsol.project.Fragments.CameraXFragment.lambda$bindPreviewForPiP$7$com-rbsol-project-Fragments-CameraXFragment(CameraXFragment.java:510)
at com.rbsol.project.Fragments.CameraXFragment$$ExternalSyntheticLambda5.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:346)
at android.os.Looper.loop(Looper.java:475)
at android.app.ActivityThread.main(ActivityThread.java:7950)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant