Skip to content

Commit

Permalink
Fix initial device selection when mounting useMediaDeviceSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Oct 22, 2024
1 parent 370c610 commit c7da2a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion packages/core/src/observables/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export function createActiveDeviceObservable(room: Room, kind: MediaDeviceKind)
log.debug('activeDeviceObservable | RoomEvent.ActiveDeviceChanged', { kind, deviceId });
return deviceId;
}),
startWith(room.getActiveDevice(kind)),
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useMediaDeviceSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function useMediaDeviceSelect({

React.useEffect(() => {
const listener = activeDeviceObservable.subscribe((deviceId) => {
if (deviceId) {
if (deviceId && deviceId !== currentDeviceId) {
log.info('setCurrentDeviceId', deviceId);
setCurrentDeviceId(deviceId);
}
Expand Down

0 comments on commit c7da2a8

Please sign in to comment.