Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fall back as eagerly to unselected devices #2802

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

robintown
Copy link
Member

Somewhere around version 131 or 132, Firefox has started being more paranoid about media device fingerprinting, and will not even give you the IDs of available devices until you've requested a media stream. Instead you only get a single audio input and video input each with the empty string as their device ID, representing the system's default device. We can recognize this case and avoid resetting the device selection.

Closes #2770

Somewhere around version 131 or 132, Firefox has started being more paranoid about media device fingerprinting, and will not even give you the IDs of available devices until you've requested a media stream. Instead you only get a single audio input and video input each with the empty string as their device ID, representing the system's default device. We can recognize this case and avoid resetting the device selection.
Comment on lines 96 to 102
// Otherwise, fall back to the first available device.
devId =
available.some((d) => d.deviceId === selectedId) ||
available.every((d) => d.deviceId === "")
? selectedId
: available.at(0)?.deviceId;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the fallback happening?
If all devices are "" we would still end up using selectedId. What if that is not available? If the browser is paranoid but also the mic has been disconnected?
Where do we catch that?

Comment on lines +96 to +98
// Worst case it is not available and the browser will gracefully fall
// back to some other device for us when requesting the media stream.
// Otherwise, select the first available device.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@robintown robintown merged commit 720c400 into element-hq:livekit Nov 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Media devices reset on reload
3 participants