Switch audio/video devices while in call
Enable the menus to switch audio/video devices.
Add connectionstatechange webRTCConnection listener to set the connected
status.
GitLab: #146
Change-Id: Ic3afbdee2b1a6bf312d3d7d902adb3c103a7d26f
diff --git a/client/src/pages/CallPending.tsx b/client/src/pages/CallPending.tsx
index cc24669..02f06e4 100644
--- a/client/src/pages/CallPending.tsx
+++ b/client/src/pages/CallPending.tsx
@@ -17,7 +17,7 @@
*/
import { Box, CircularProgress, Grid, IconButtonProps, Stack, Typography } from '@mui/material';
-import { ComponentType, ReactNode, useContext, useEffect, useMemo, useRef } from 'react';
+import { ComponentType, ReactNode, useContext, useEffect, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom';
@@ -35,14 +35,13 @@
export const CallPending = () => {
const { localStream } = useContext(WebRtcContext);
const { conversation } = useContext(ConversationContext);
- const { callRole } = useContext(CallContext);
- const localVideoRef = useRef<HTMLVideoElement | null>(null);
+ const { callRole, localVideoRef } = useContext(CallContext);
useEffect(() => {
if (localStream && localVideoRef.current) {
localVideoRef.current.srcObject = localStream;
}
- }, [localStream]);
+ }, [localStream, localVideoRef]);
return (
<Stack