livekit / client-sdk-android

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

Remote participant track mute/unmute is not signaled in the sample app's UI #297

Open adrian-niculescu opened 9 months ago

adrian-niculescu commented 9 months ago

Describe the bug Enabling/disabling audio/video by another participant is not visible on Android until the state is re-read.

To Reproduce Steps to reproduce the behavior: Using the sample-app-compose:

  1. Connect to a Room so that there are at least 2 Participants with audio and video enabled.
  2. Mute the audio on a remote Participant.
  3. The local Android user does not see the UI change. Note: Opening a menu (e.g. to select the audio output or to send a message) refreshes the UI, showing the correct "muted" icon for the remote participant.

Expected behavior The UI (muted icon) should change immediately when a remote Participant makes the change.

Device Info:

Reproduced on both a real device and an emulator.

Additional context Reproduced when the remote Participant is either Android or the LiveKit JS client example app.

The same applies for "unmute", too.

Mute/unmute by the local user is immediately visible in own UI.

Validated that the RoomEvent.TrackMuted/RoomEvent.TrackUnmuted events do come as exppected by adding logs in the CallViewModel.kt:

            // Handle room events.
            launch {
                room.events.collect {
                    when (it) {
                        is RoomEvent.FailedToConnect -> mutableError.value = it.error
                        is RoomEvent.DataReceived -> {
                            val identity = it.participant?.identity ?: "server"
                            messagesReceived++
                            Timber.e { "message received from $identity, count $messagesReceived" }
                        }
                        is RoomEvent.TrackMuted -> {
                            Timber.e {"Room Track event: TrackMuted: $it" }
                        }
                        is RoomEvent.TrackUnmuted -> {
                            Timber.e {"Room Track event: TrackUnmuted: $it" }
                        }
                        is RoomEvent.TrackPublished -> {
                            Timber.e {"Room Track event: TrackPublished: $it" }
                        }
                        is RoomEvent.TrackUnpublished -> {
                            Timber.e {"Room Track event: TrackUnpublished: $it" }
                        }
                        else -> {
                            Timber.e { "Room event: $it" }
                        }
                    }
                }
            }

so it's an issue with the propagation to the UI.

davidliu commented 9 months ago

Ah, looks like this isn't using a state for propagating changes to the UI. Thanks for pointing this out.