Skip to content

Restarted audio tracks always get "default" deviceId constraint #1608

@v-flashpoint

Description

@v-flashpoint

Describe the bug

What I'm expecting

When creating an audio track using createLocalTracks(), the user is given a permissions prompt through the browser, and track._constraints.deviceId is updated to be whatever they chose.

However, if the user then revokes microphone permission, although the user is prompted to choose another microphone, track._constraints.deviceId always gets set to default. This means that any future attempts to mute/unmute using this mic will cause the track to be reacquired, as laid out in LocalAudioTrack.ts, as the deviceIds no longer match, causing a brief flicker in the stream.

I was expecting that when the user chose their preferred microphone from the dialogue, the track._constraints.deviceId would be updated with the option they chose, as it is when they first create the track using createLocalTracks.

What happens instead

See above

Reproduction

  • Create audio and video tracks using createLocalTracks() (it may also be important to choose a non-default mic)
  • Revoke permission to your microphone
  • Choose another mic (in my case, I chose the same one again)
  • Mute and unmute
  • LiveKit will attempt to reacquire the track due to a mismatch in the deviceId

Logs

System Info

Windows 10, Firefox 140.0.4, latest LiveKit JS SDK

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions