Bind Webcam and WebRTC video stream to CallInterface
Add working mute and webcam on/off buttons.
Add rudimentary start webrtc call functionnality. This is only a first step, it will be improved in the future.
GitLab: #74
Change-Id: Ic3afde596a60fa2e9ea6199e3d632366078ec9fe
diff --git a/client/src/components/CallButtons.tsx b/client/src/components/CallButtons.tsx
index 6cc3cb0..815fade 100644
--- a/client/src/components/CallButtons.tsx
+++ b/client/src/components/CallButtons.tsx
@@ -19,7 +19,7 @@
import { styled } from '@mui/material/styles';
import React, { useContext } from 'react';
-import { CallContext } from '../contexts/CallProvider';
+import { WebRTCContext } from '../contexts/WebRTCProvider';
import { ToggleIconButton, ToggleIconButtonProps } from './Button';
import {
CallEndIcon,
@@ -100,7 +100,7 @@
};
export const CallingMicButton = (props: Partial<ToggleIconButtonProps>) => {
- const { micOn, setMicOn } = useContext(CallContext);
+ const { isAudioOn, setAudioStatus } = useContext(WebRTCContext);
return (
<ToggleIconButton
@@ -108,15 +108,15 @@
sx={{ color: 'white' }}
IconOn={MicroIcon}
IconOff={MicroOffIcon}
- selected={micOn}
- toggle={() => setMicOn((s) => !s)}
+ selected={isAudioOn}
+ toggle={() => setAudioStatus(!isAudioOn)}
{...props}
/>
);
};
export const CallingVideoCameraButton = (props: Partial<ToggleIconButtonProps>) => {
- const { camOn, setCamOn } = useContext(CallContext);
+ const { isVideoOn, setVideoStatus } = useContext(WebRTCContext);
return (
<ToggleIconButton
@@ -124,8 +124,8 @@
sx={{ color: 'white' }}
IconOn={VideoCameraIcon}
IconOff={VideoCameraOffIcon}
- selected={camOn}
- toggle={() => setCamOn((s) => !s)}
+ selected={isVideoOn}
+ toggle={() => setVideoStatus(!isVideoOn)}
{...props}
/>
);