then tap the switchCameraButton multiple times in rapid succession.
The demo app (built from the v1.0.0 branch) has separate buttons for setting front and back camera, but it exhibits similar behavior if you alternate between them too quickly.
Expected Behavior
The 0.13.2 demo app (from the Play Store) apparently actually performs the toggle once for every time you tap the button, and while this may take several seconds it still works when it's done.
Actual Behavior
The camera preview freezes altogether. My best guess is that the library is failing to release a camera resource in time to start a new one, but I don't understand Kotlin coroutines well enough to figure out where exactly it's going wrong.
I've tried adding a CameraListener to the CameraKitView and debouncing further calls to toggleFacing() until the listener's onOpened() method is called, figuring that it must be safe to toggle the camera again once it's re-opened, but the issue persisted. I guess there's still a small window after onOpened() where it still isn't safe to toggle. At the very least a reliable notification of when it's safe to toggle again would be helpful.
Is this a bug report?
Yes.
Have you read the Contributing Guidelines?
Yes.
Environment
Android Studio emulator, Kyocera DuraForce Pro, Sony Xperia XA2 Ultra, and others CameraKit v1.0.0-beta3.11
Steps to Reproduce
then tap the switchCameraButton multiple times in rapid succession.
The demo app (built from the v1.0.0 branch) has separate buttons for setting front and back camera, but it exhibits similar behavior if you alternate between them too quickly.
Expected Behavior
The 0.13.2 demo app (from the Play Store) apparently actually performs the toggle once for every time you tap the button, and while this may take several seconds it still works when it's done.
Actual Behavior
The camera preview freezes altogether. My best guess is that the library is failing to release a camera resource in time to start a new one, but I don't understand Kotlin coroutines well enough to figure out where exactly it's going wrong.
I've tried adding a CameraListener to the CameraKitView and debouncing further calls to
toggleFacing()
until the listener'sonOpened()
method is called, figuring that it must be safe to toggle the camera again once it's re-opened, but the issue persisted. I guess there's still a small window afteronOpened()
where it still isn't safe to toggle. At the very least a reliable notification of when it's safe to toggle again would be helpful.