Skip to content

Commit

Permalink
Merge pull request #2691 from robintown/duplicate-devices
Browse files Browse the repository at this point in the history
Remove duplicate media devices from the list
  • Loading branch information
robintown authored Oct 28, 2024
2 parents 7edc8af + 0ec5601 commit e06aaf6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/livekit/MediaDevicesContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ function useMediaDevice(
}

return {
available: available ?? [],
available: available
? // Sometimes browsers (particularly Firefox) can return multiple
// device entries for the exact same device ID; deduplicate them
[...new Map(available.map((d) => [d.deviceId, d])).values()]
: [],
selectedId: alwaysDefault ? undefined : devId,
select,
};
Expand Down

0 comments on commit e06aaf6

Please sign in to comment.