Utilizing the Camera/Microphone in the Background
cyodrew opened this issue · 0 comments
Before filing an issue please check that the issue is not already addressed by the following:
Please ensure that you are not sharing any
Personally Identifiable Information(PII)
or sensitive account information (API keys, credentials, etc.) when reporting an issue.
Description
Is there a way to keep a Room camera/microphone active when the app is placed into the background, and if so, detect if camera/microphone are being utilized by another app or have a callback notifying the app that the camera/microphone are no longer available?
Steps to Reproduce
- Utilize a foreground service that will allow the camera/microphone to be used while the app is in the background (not needed in this example but better practice)
- Do not release the camera
onPause
(goal is to only hold the camera/microphone if Room is active) - Open another camera app such as the native device Camera app
Code
N/A
Expected Behavior
Error is raised through Camera2Capturer.Listener#onError(Camera2Capturer.Exception)
or CameraCapturer#onError(int)
Actual Behavior
Camera is given to requesting app and upon returning to the quickstart app, video view is black. No error raised besides an error log from the Camera
Reproduces how Often
100%
Logs
com.twilio.video.quickstart.kotlin E/CameraCaptureSession: Session 0: Exception while stopping repeating:
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): cancelRequest:547: Camera 2: Error clearing streaming request: Function not implemented (-38)
at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1340)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:99)
at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1259)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:578)
at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:789)
at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.os.ServiceSpecificException: cancelRequest:547: Camera 2: Error clearing streaming request: Function not implemented (-38) (code 10)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2399)
at android.os.Parcel.createException(Parcel.java:2369)
at android.os.Parcel.readException(Parcel.java:2352)
at android.os.Parcel.readException(Parcel.java:2294)
at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:750)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:97)
Versions
All relevant version information for issue.
Video Android SDK
7.1.0
Android API
Android 12
Android Device
Pixel 3a