Skip to content

Image not captured on beta 11 with Samsung A3 #577

Open

Description

@akiller

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

CameraKit Version: v1.0.0beta3.11 and v1.0.0beta3.10

Android Device: Samsung A3 (2017)

Android Version: 8.0.0

Steps to Reproduce

  1. Build/run CameraKit demo app
  2. Click take photo

Expected Behavior

Photo to be captured and the preview image displayed on the UI.

Actual Behavior

The camera preview is still visible but the photo is never captured. On beta 10 the photo is eventually captured if I use my hand to cover up the camera so it goes black after clicking the capture button - it's very strange!

Here's a quick video demonstrating what I mean:
https://photos.app.goo.gl/Q4ms9u9sXUvVkwzc9

Stepping through the code in a debugger what I believe might be the root cause is that when CameraPreview.capturePhoto() is called it runs GlobalScope.launch with a callback. If I put a breakpoint on the callback it never gets hit, therefore, none of the capture logic gets ran.

As another test I put a breakpoint in the callback for it inside pause() and navigated to another app and that didn't get hit either.

Perhaps I'm missing something as Kotlin and coroutines are a bit of a mystery to me.

Activity

  1. akiller commented on Oct 10, 2019

    @akiller
    Author

    I've been trying to get to the bottom of this all day, still no luck. However, if I set FORCE_DEPRECATED_API to true so it uses Camera 1 it seems to work fine, therefore it looks like it could be a Camera2 issue?

  2. changed the title [-]Image not captured on beta 11 with a Samsung Galaxy A3[/-] [+]Image not captured on beta 11 with a Samsung Galaxy S7/A3[/+] on Oct 10, 2019
  3. changed the title [-]Image not captured on beta 11 with a Samsung Galaxy S7/A3[/-] [+]Image not captured on beta 11 with Samsung Galaxy S7 / A3 / XCover 2[/+] on Oct 10, 2019
  4. changed the title [-]Image not captured on beta 11 with Samsung Galaxy S7 / A3 / XCover 2[/-] [+]Image not captured on beta 11 with Samsung A3[/+] on Oct 10, 2019
  5. akiller commented on Oct 11, 2019

    @akiller
    Author

    Sorry for the comment spam but I've half got around this by introducing the ability for the application to manually override which camera API gets used, either by setting the attribute app:camera_apiVersion or using cameraView.setCameraApiVersion(). Setting these to auto defaults to your current behaviour for figuring out which to use, or you can use "camera1" or "camera2" to force whichever one you like.

    I can't create a pull request because the beta11 branch appears to be deleted, and the develop branch appears to be broke and an older version of the library . So here is both a link to my repo with the changes on and a patch :

    https://github.com/akiller/camerakit-android/tree/switch-camera-api

    patch.txt

    I think allowing the app to switch the camera API out when something goes wrong is a good idea, but hopefully we can figure out why camera2 is broke in this instance too.

  6. luga97 commented on Oct 28, 2019

    @luga97

    I have same issue on Xiaomi Redmi 6A and Samsung Galaxy S7, i solved this problem using v1.0.0beta3.10

  7. akiller commented on Oct 28, 2019

    @akiller
    Author

    I think we upgraded from 3.10 too which triggered it. We've also found this breaks on a Motorola 6.

    A colleague of mine thinks he might have fixed the problem in 3.11. There were two issues he found within coroutines queues and the use of global scope which broke it.

    We'll submit a pull request/patch if our testing proves this works, I expect it to take a week or so.

  8. kiler222 commented on Dec 22, 2019

    @kiler222

    I used your patch and it works. Thanks a lot:)

    I confirm that when I force set 'camera1' to be used then capturing images works fine. Once I switch to camera2 then it breaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions