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

Fix initial device selection when mounting useMediaDeviceSelect #1014

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Oct 22, 2024

No description provided.

@lukasIO lukasIO requested a review from Ocupe October 22, 2024 08:37
Copy link

changeset-bot bot commented Oct 22, 2024

🦋 Changeset detected

Latest commit: 843a20f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@livekit/components-core Patch
@livekit/components-react Patch
@livekit/component-example-next Patch
@livekit/components-js-docs Patch
@livekit/component-docs-storybook Patch
@livekit/components-docs-gen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 22, 2024

size-limit report 📦

Path Size
LiveKitRoom only 5.99 KB (0%)
LiveKitRoom with VideoConference 29.75 KB (-0.03% 🔽)
All exports 36.49 KB (-0.05% 🔽)

@@ -249,7 +249,6 @@ export function createActiveDeviceObservable(room: Room, kind: MediaDeviceKind)
log.debug('activeDeviceObservable | RoomEvent.ActiveDeviceChanged', { kind, deviceId });
return deviceId;
}),
startWith(room.getActiveDevice(kind)),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this causes the active device to change whenever the useMediaDeviceSelect hook is mounted. Instead, shift the responsibility for initializing with the correct value into the hook's initial currentDeviceId state, which has been done already in https://github.com/livekit/components-js/pull/1012/files#diff-246daab5d71d5f9448a651e07a59775cbdccae8b7863e9f289fab063686772d1R57

Copy link
Contributor

@Ocupe Ocupe left a comment

Choose a reason for hiding this comment

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

👍

@lukasIO lukasIO merged commit 5e31441 into main Oct 22, 2024
3 checks passed
@lukasIO lukasIO deleted the lukas/fix-initial-active-device branch October 22, 2024 09:17
@github-actions github-actions bot mentioned this pull request Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants