Skip to content

java.lang.IllegalArgumentException: Surface was abandoned #19

@std-microblock

Description

@std-microblock

for some reason the surface is abandoned, a simple retry fixes the problem

    private suspend fun createCaptureSession(
        device: CameraDevice, targets: List<Surface>, handler: Handler? = null
    ): CameraCaptureSession? = suspendCoroutine { cont ->
        if (targets.any {
            !it.isValid
            }) {
            // re-initialize the camera
            Log.w("CamEngine", "Invalid surface targets, re-initializing camera")
            cont.resume(null);
            return@suspendCoroutine
        }
  // .....


		session = createCaptureSession(camera, targets, cameraHandler)
        if (session == null) {
            Log.i("CAMERA", "session is null")
            return initializeCamera();
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions