livekit / client-sdk-android

LiveKit SDK for Android
https://docs.livekit.io
Apache License 2.0
169 stars 68 forks source link

Camera active indicator stays on when Room is disconnected by turning off the network connection #296

Open adrian-niculescu opened 10 months ago

adrian-niculescu commented 10 months ago

Describe the bug Camera active indicator remains on when Room is disconnected by turning off the internet on Android.

To Reproduce The behaviour reproduces in your sample app (e.g. sample-app-compose), too. Steps to reproduce the behavior using your sample app:

  1. Connect to a Room. Make sure Audio and video are working as expected (send and receive).
  2. Turn off the internet connection on Android.
  3. The Room is automatically disconnected on Android.
  4. The Android indicator that shows the camera is being used stays on indefinitely, until the app is closed by the user.

Expected behavior The camera indicator should turn off (camera should not be used anymore), as it does when the Room is disconnected in normal conditions.

Screenshots camera_active_indicator_on

Device Info:

also replicated on a Google Pixel 4A with Android 14, API 34.

Additional context Android logs after turning off the internet: android.log

adrian-niculescu commented 10 months ago

As a workaround, I tried to manually disable the camera when the event that the Room is disconnected is received:

room.localParticipant.setCameraEnabled(false)

or

room.localParticipant.videoTracks.forEach { it.second!!.stop() }

(or both) with no success.