-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add a button to switch the camera on mobile #2694
Conversation
I think it makes sense to immediately think about > 2 cameras. I think nowadays, the amount of ===2 camera phones is very limited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a screenshot?
I am not sure what icon and css it is using.
But it seems its adding another entry in the bottom button list.
It does not handle clicks on your video tile rigth?
I don't have an iPhone to test with so I'll need someone to report what the device names are (so I can get an idea for whether analyzing them for their facing direction is possible) and also what the expected behavior is when you switch cameras in say, Facetime. |
Android Samsung S21
Chrome:
|
tested with Pixle 7 Pro -> nice is localization an issue? Safari on iOS has a German translation:
|
Haha, localization is what I feared :D |
115a3c2
to
9de07c7
Compare
nice: just tested on
|
Tested on S21 If i set it to one of the other cameras in the device drawer settings menu i dont get a stream anymore. Playing around with it more: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two review comments:
- Does it make sense to use the same logic we have for the mute button? Each press independent if the camera has updated already swapts the target state. We always wait until the camera has finished updating/(track has sucessfully changed) only then we start the next update in case the user has pressed the button as many times so the current state is not the target state?
- should we remove the video device selector on mobile knowing that my phone can get into a "broken" state? I also dont see any benefit to choose a specific device on mobile especially if the device descriptions are so poor.
We can entirely drop the settings tab on mobile. On desktop i do see value in selecting the exact webcam one wants to use.
9de07c7
to
8c02809
Compare
In the mute button case, I think this was motivated by the immediate feedback that we have to provide in the form of changing the button's state. We don't have to provide any such feedback for the switch camera button, so I'd prefer to avoid complicating it. Or is there another reason to try that?
I'm not sure what you mean here. The video device selector does update when the camera is switched. |
I was considering to entirely remove the video tab from the settings. So that the only way to select a camera device is by the switch button |
What does happen if i press the button twice (quickly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good.
I left a non blocking comment.
Thanks!
const localTrackOptions = useMemo( | ||
() => ({ | ||
// The only reason we request audio here is to get the audio permission | ||
// request over with at the same time. But changing the audio settings | ||
// shouldn't cause this hook to recreate the track, which is why we | ||
// reference the initial values here. | ||
// We also pass in a clone because livekit mutates the object passed in, | ||
// which would cause the devices to be re-opened on the next render. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this moved to the lobby file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously the only thing that needed the video track was the VideoPreview itself, but now the LobbyView wants to render a button which accesses the track as well, so I hoisted the video track and the code for starting it up to this component
I was more asking about what you mean by 'broken', as the state seemed to stay accurate in my testing
It appears to simply ignore the second click, yeah, which is an acceptable behavior here IMO |
No description provided.