Skip to content

Toggling microphone while reconnecting kills the ability to use it #879

@crbarreto

Description

@crbarreto

Describe the bug
When a user is reconnecting to an ongoing call and while reconnecting the user toggles the microphone, the microphone control no longer functions after the call is reconnected, returning false on localParticipant.setMicrophoneEnabled(...) and no known way to recover from this.

To Reproduce

  1. Start a call with another user
  2. Disconnect WiFi/connection for one user while the call is ongoing
  3. On the device the connection was disconnected, toggle the microphone
  4. Enable the WiFi/connection
  5. Once the call is reconnected, try toggling the microphone again

Note: In step 3, if the microphone toggle method is not contained inside a try...catch block, the app will crash with the following exception:

 java.lang.IllegalStateException: publisher is not configured yet!
 	at io.livekit.android.room.participant.LocalParticipant.publishTrackImpl$negotiate(LocalParticipant.kt:673)
 	at io.livekit.android.room.participant.LocalParticipant.access$publishTrackImpl$negotiate(LocalParticipant.kt:97)
 	at io.livekit.android.room.participant.LocalParticipant$publishTrackImpl$4$negotiateJob$1.invokeSuspend(LocalParticipant.kt:747)
 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)

Expected behavior
Toggling the microphone should work without issues regardless of the room connection state.

Additional context
This was discovered using LiveKit Android 2.23.5 and verified on 3 different devices (two Google Pixels and one Samsung Galaxy). All displayed the same behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions