File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -280,20 +280,25 @@ function RoomScreen() {
280280 const [queryMicrophone, requestMicrophone] = useMicrophonePermissions (); // [!code highlight]
281281 const { initializeDevices } = useInitializeDevices (); // [!code highlight]
282282
283- const setup = async () => {
284- let cam = await queryCamera ();
285- let mic = await queryMicrophone ();
286-
287- if (cam !== " granted" ) cam = await requestCamera ();
288- if (mic !== " granted" ) mic = await requestMicrophone ();
283+ useEffect (() => {
284+ const setup = async () => {
285+ let cam = await queryCamera ();
286+ let mic = await queryMicrophone ();
289287
290- if (cam === " granted" && mic === " granted" ) {
291- await initializeDevices (); // [!code highlight]
292- }
293- };
288+ if (cam !== " granted" ) cam = await requestCamera ();
289+ if (mic !== " granted" ) mic = await requestMicrophone ();
294290
295- useEffect (() => {
291+ if (cam === " granted" && mic === " granted" ) {
292+ await initializeDevices (); // [!code highlight]
293+ }
294+ };
296295 setup ();
297- }, []);
296+ }, [
297+ queryCamera ,
298+ requestCamera ,
299+ queryMicrophone ,
300+ requestMicrophone ,
301+ initializeDevices ,
302+ ]);
298303}
299304```
You can’t perform that action at this time.
0 commit comments