Also fix camera reloading in widget mode
This commit is contained in:
@@ -184,6 +184,16 @@ export const LobbyView: FC<Props> = ({
|
|||||||
null) as LocalVideoTrack | null,
|
null) as LocalVideoTrack | null,
|
||||||
[tracks],
|
[tracks],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (videoTrack && videoInputId === undefined) {
|
||||||
|
// If we have a video track but no videoInputId,
|
||||||
|
// we have to update the available devices. So that we select the first
|
||||||
|
// available video input device as the default instead of the `""` id.
|
||||||
|
devices.requestDeviceNames();
|
||||||
|
}
|
||||||
|
}, [devices, videoInputId, videoTrack]);
|
||||||
|
|
||||||
useTrackProcessorSync(videoTrack);
|
useTrackProcessorSync(videoTrack);
|
||||||
const showSwitchCamera = useShowSwitchCamera(
|
const showSwitchCamera = useShowSwitchCamera(
|
||||||
useObservable(
|
useObservable(
|
||||||
|
|||||||
@@ -355,6 +355,9 @@ export class MediaDevices {
|
|||||||
* available device, rather than numbered identifiers. This may invoke a
|
* available device, rather than numbered identifiers. This may invoke a
|
||||||
* permissions pop-up, so it should only be called when there is a clear user
|
* permissions pop-up, so it should only be called when there is a clear user
|
||||||
* intent to view the device list.
|
* intent to view the device list.
|
||||||
|
*
|
||||||
|
* This always updates the `available$` devices for each media type with the current value
|
||||||
|
* of `enumerateDevices`.
|
||||||
*/
|
*/
|
||||||
public requestDeviceNames(): void {
|
public requestDeviceNames(): void {
|
||||||
void navigator.mediaDevices.enumerateDevices().then((result) => {
|
void navigator.mediaDevices.enumerateDevices().then((result) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user