simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 Savoir-faire Linux Inc. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU Affero General Public License as |
| 6 | * published by the Free Software Foundation; either version 3 of the |
| 7 | * License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU Affero General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Affero General Public |
| 15 | * License along with this program. If not, see |
| 16 | * <https://www.gnu.org/licenses/>. |
| 17 | */ |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 18 | import { CallAction, CallBegin, WebSocketMessageType } from 'jami-web-common'; |
Misha Krieger-Raynauld | 20cf1c8 | 2022-11-23 20:26:50 -0500 | [diff] [blame] | 19 | import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'; |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 20 | import { Navigate, useNavigate } from 'react-router-dom'; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 21 | |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 22 | import LoadingPage from '../components/Loading'; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 23 | import { useUrlParams } from '../hooks/useUrlParams'; |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 24 | import CallPermissionDenied from '../pages/CallPermissionDenied'; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 25 | import { CallRouteParams } from '../router'; |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 26 | import { callTimeoutMs } from '../utils/constants'; |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 27 | import { SetState, WithChildren } from '../utils/utils'; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 28 | import { ConversationContext } from './ConversationProvider'; |
Misha Krieger-Raynauld | 20cf1c8 | 2022-11-23 20:26:50 -0500 | [diff] [blame] | 29 | import { WebRtcContext } from './WebRtcProvider'; |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 30 | import { IWebSocketContext, WebSocketContext } from './WebSocketProvider'; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 31 | |
| 32 | export type CallRole = 'caller' | 'receiver'; |
| 33 | |
| 34 | export enum CallStatus { |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 35 | Default, |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 36 | Loading, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 37 | Ringing, |
| 38 | Connecting, |
| 39 | InCall, |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 40 | PermissionsDenied, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | export interface ICallContext { |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 44 | isAudioOn: boolean; |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 45 | setIsAudioOn: SetState<boolean>; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 46 | isVideoOn: boolean; |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 47 | setIsVideoOn: SetState<boolean>; |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 48 | isChatShown: boolean; |
| 49 | setIsChatShown: SetState<boolean>; |
simon | 2a5cf14 | 2022-11-25 15:47:35 -0500 | [diff] [blame] | 50 | isFullscreen: boolean; |
| 51 | setIsFullscreen: SetState<boolean>; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 52 | callRole: CallRole; |
| 53 | callStatus: CallStatus; |
Gabriel Rochon | e382a30 | 2022-11-23 12:37:04 -0500 | [diff] [blame] | 54 | callStartTime: Date | undefined; |
Charlie | c444ab7 | 2022-11-29 18:24:27 -0500 | [diff] [blame] | 55 | isAnswerButtonDisabled: boolean; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 56 | |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 57 | acceptCall: (withVideoOn: boolean) => void; |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 58 | endCall: () => void; |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | const defaultCallContext: ICallContext = { |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 62 | isAudioOn: false, |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 63 | setIsAudioOn: () => {}, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 64 | isVideoOn: false, |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 65 | setIsVideoOn: () => {}, |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 66 | isChatShown: false, |
| 67 | setIsChatShown: () => {}, |
simon | 2a5cf14 | 2022-11-25 15:47:35 -0500 | [diff] [blame] | 68 | isFullscreen: false, |
| 69 | setIsFullscreen: () => {}, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 70 | callRole: 'caller', |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 71 | callStatus: CallStatus.Default, |
Gabriel Rochon | e382a30 | 2022-11-23 12:37:04 -0500 | [diff] [blame] | 72 | callStartTime: undefined, |
Charlie | c444ab7 | 2022-11-29 18:24:27 -0500 | [diff] [blame] | 73 | isAnswerButtonDisabled: false, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 74 | |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 75 | acceptCall: (_: boolean) => {}, |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 76 | endCall: () => {}, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | export const CallContext = createContext<ICallContext>(defaultCallContext); |
| 80 | |
| 81 | export default ({ children }: WithChildren) => { |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 82 | const webSocket = useContext(WebSocketContext); |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 83 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 84 | if (!webSocket) { |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 85 | return <LoadingPage />; |
| 86 | } |
| 87 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 88 | return <CallProvider webSocket={webSocket}>{children}</CallProvider>; |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | const CallProvider = ({ |
| 92 | children, |
| 93 | webSocket, |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 94 | }: WithChildren & { |
| 95 | webSocket: IWebSocketContext; |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 96 | }) => { |
Charlie | b837e8f | 2022-11-28 19:18:46 -0500 | [diff] [blame] | 97 | const { state: routeState } = useUrlParams<CallRouteParams>(); |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 98 | const { localStream, sendWebRtcOffer, iceConnectionState, closeConnection, getUserMedia } = useContext(WebRtcContext); |
Misha Krieger-Raynauld | 20cf1c8 | 2022-11-23 20:26:50 -0500 | [diff] [blame] | 99 | const { conversationId, conversation } = useContext(ConversationContext); |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 100 | const navigate = useNavigate(); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 101 | |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 102 | const [isAudioOn, setIsAudioOn] = useState(false); |
| 103 | const [isVideoOn, setIsVideoOn] = useState(false); |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 104 | const [isChatShown, setIsChatShown] = useState(false); |
simon | 2a5cf14 | 2022-11-25 15:47:35 -0500 | [diff] [blame] | 105 | const [isFullscreen, setIsFullscreen] = useState(false); |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 106 | const [callStatus, setCallStatus] = useState(routeState?.callStatus); |
Charlie | b837e8f | 2022-11-28 19:18:46 -0500 | [diff] [blame] | 107 | const [callRole] = useState(routeState?.role); |
Gabriel Rochon | e382a30 | 2022-11-23 12:37:04 -0500 | [diff] [blame] | 108 | const [callStartTime, setCallStartTime] = useState<Date | undefined>(undefined); |
Charlie | c444ab7 | 2022-11-29 18:24:27 -0500 | [diff] [blame] | 109 | const [isAnswerButtonDisabled, setIsAnswerButtonDisabled] = useState(false); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 110 | |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 111 | // TODO: This logic will have to change to support multiple people in a call. Could we move this logic to the server? |
| 112 | // The client could make a single request with the conversationId, and the server would be tasked with sending |
| 113 | // all the individual requests to the members of the conversation. |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 114 | const contactUri = useMemo(() => conversation.getFirstMember().contact.getUri(), [conversation]); |
| 115 | |
| 116 | useEffect(() => { |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 117 | if (localStream) { |
| 118 | for (const track of localStream.getAudioTracks()) { |
| 119 | track.enabled = isAudioOn; |
| 120 | } |
simon | feaa1db | 2022-11-26 20:13:18 -0500 | [diff] [blame] | 121 | } |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 122 | }, [isAudioOn, localStream]); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 123 | |
| 124 | useEffect(() => { |
simon | f353ef4 | 2022-11-28 23:14:53 -0500 | [diff] [blame] | 125 | if (localStream) { |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 126 | for (const track of localStream.getVideoTracks()) { |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 127 | track.enabled = isVideoOn; |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 128 | } |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 129 | } |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 130 | }, [isVideoOn, localStream]); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 131 | |
| 132 | useEffect(() => { |
simon | 2a5cf14 | 2022-11-25 15:47:35 -0500 | [diff] [blame] | 133 | const onFullscreenChange = () => { |
| 134 | setIsFullscreen(document.fullscreenElement !== null); |
| 135 | }; |
| 136 | |
| 137 | document.addEventListener('fullscreenchange', onFullscreenChange); |
| 138 | return () => { |
| 139 | document.removeEventListener('fullscreenchange', onFullscreenChange); |
| 140 | }; |
| 141 | }, []); |
| 142 | |
| 143 | useEffect(() => { |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 144 | if (callRole === 'caller' && callStatus === CallStatus.Default) { |
| 145 | setCallStatus(CallStatus.Loading); |
| 146 | getUserMedia() |
| 147 | .then(() => { |
| 148 | const callBegin: CallBegin = { |
| 149 | contactId: contactUri, |
| 150 | conversationId, |
| 151 | withVideoOn: routeState?.isVideoOn ?? false, |
| 152 | }; |
| 153 | |
| 154 | setCallStatus(CallStatus.Ringing); |
| 155 | setIsVideoOn(routeState?.isVideoOn ?? false); |
| 156 | console.info('Sending CallBegin', callBegin); |
| 157 | webSocket.send(WebSocketMessageType.CallBegin, callBegin); |
| 158 | }) |
| 159 | .catch((e) => { |
| 160 | console.error(e); |
| 161 | setCallStatus(CallStatus.PermissionsDenied); |
| 162 | }); |
| 163 | } |
| 164 | }, [webSocket, getUserMedia, callRole, callStatus, contactUri, conversationId, routeState]); |
| 165 | |
| 166 | const acceptCall = useCallback( |
| 167 | (withVideoOn: boolean) => { |
| 168 | setCallStatus(CallStatus.Loading); |
Charlie | c444ab7 | 2022-11-29 18:24:27 -0500 | [diff] [blame] | 169 | setIsAnswerButtonDisabled(true); |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 170 | getUserMedia() |
| 171 | .then(() => { |
| 172 | const callAccept: CallAction = { |
| 173 | contactId: contactUri, |
| 174 | conversationId, |
| 175 | }; |
| 176 | |
| 177 | setIsVideoOn(withVideoOn); |
| 178 | setCallStatus(CallStatus.Connecting); |
| 179 | console.info('Sending CallAccept', callAccept); |
| 180 | webSocket.send(WebSocketMessageType.CallAccept, callAccept); |
| 181 | }) |
| 182 | .catch((e) => { |
| 183 | console.error(e); |
| 184 | setCallStatus(CallStatus.PermissionsDenied); |
| 185 | }); |
| 186 | }, |
| 187 | [webSocket, getUserMedia, contactUri, conversationId] |
| 188 | ); |
| 189 | |
| 190 | useEffect(() => { |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 191 | if (callRole === 'caller' && callStatus === CallStatus.Ringing) { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 192 | const callAcceptListener = (data: CallAction) => { |
| 193 | console.info('Received event on CallAccept', data); |
Charlie | c18d640 | 2022-11-27 13:01:04 -0500 | [diff] [blame] | 194 | if (data.conversationId !== conversationId) { |
| 195 | console.warn('Wrong incoming conversationId, ignoring action'); |
| 196 | return; |
| 197 | } |
| 198 | |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 199 | setCallStatus(CallStatus.Connecting); |
| 200 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 201 | sendWebRtcOffer(); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 202 | }; |
| 203 | |
| 204 | webSocket.bind(WebSocketMessageType.CallAccept, callAcceptListener); |
| 205 | |
| 206 | return () => { |
| 207 | webSocket.unbind(WebSocketMessageType.CallAccept, callAcceptListener); |
| 208 | }; |
| 209 | } |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 210 | }, [callRole, webSocket, sendWebRtcOffer, callStatus, conversationId]); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 211 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 212 | const endCall = useCallback(() => { |
| 213 | const callEnd: CallAction = { |
| 214 | contactId: contactUri, |
| 215 | conversationId, |
| 216 | }; |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 217 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 218 | console.info('Sending CallEnd', callEnd); |
| 219 | closeConnection(); |
| 220 | webSocket.send(WebSocketMessageType.CallEnd, callEnd); |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 221 | navigate(`/conversation/${conversationId}`); |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 222 | // TODO: write in chat that the call ended |
| 223 | }, [webSocket, contactUri, conversationId, closeConnection, navigate]); |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 224 | |
| 225 | useEffect(() => { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 226 | const callEndListener = (data: CallAction) => { |
| 227 | console.info('Received event on CallEnd', data); |
Charlie | c18d640 | 2022-11-27 13:01:04 -0500 | [diff] [blame] | 228 | if (data.conversationId !== conversationId) { |
| 229 | console.warn('Wrong incoming conversationId, ignoring action'); |
| 230 | return; |
| 231 | } |
| 232 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 233 | closeConnection(); |
| 234 | navigate(`/conversation/${conversationId}`); |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 235 | // TODO: write in chat that the call ended |
| 236 | }; |
| 237 | |
| 238 | webSocket.bind(WebSocketMessageType.CallEnd, callEndListener); |
| 239 | return () => { |
| 240 | webSocket.unbind(WebSocketMessageType.CallEnd, callEndListener); |
| 241 | }; |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 242 | }, [webSocket, navigate, conversationId, closeConnection]); |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 243 | |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 244 | useEffect(() => { |
Charlie | b837e8f | 2022-11-28 19:18:46 -0500 | [diff] [blame] | 245 | if ( |
| 246 | callStatus === CallStatus.Connecting && |
| 247 | (iceConnectionState === 'connected' || iceConnectionState === 'completed') |
| 248 | ) { |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 249 | console.info('Changing call status to InCall'); |
| 250 | setCallStatus(CallStatus.InCall); |
Gabriel Rochon | e382a30 | 2022-11-23 12:37:04 -0500 | [diff] [blame] | 251 | setCallStartTime(new Date()); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 252 | } |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 253 | }, [iceConnectionState, callStatus]); |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 254 | |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 255 | useEffect(() => { |
Charlie | 380dc5e | 2022-11-29 16:51:42 -0500 | [diff] [blame] | 256 | if (iceConnectionState === 'disconnected' || iceConnectionState === 'failed') { |
| 257 | console.info('ICE connection disconnected or failed, ending call'); |
Charlie | b837e8f | 2022-11-28 19:18:46 -0500 | [diff] [blame] | 258 | endCall(); |
| 259 | } |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 260 | }, [iceConnectionState, callStatus, isVideoOn, endCall]); |
Charlie | b837e8f | 2022-11-28 19:18:46 -0500 | [diff] [blame] | 261 | |
| 262 | useEffect(() => { |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 263 | const checkStatusTimeout = () => { |
| 264 | if (callStatus !== CallStatus.InCall) { |
| 265 | endCall(); |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 266 | } |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 267 | }; |
| 268 | const timeoutId = setTimeout(checkStatusTimeout, callTimeoutMs); |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 269 | |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 270 | return () => { |
| 271 | clearTimeout(timeoutId); |
| 272 | }; |
| 273 | }, [callStatus, endCall]); |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 274 | |
Charlie | b837e8f | 2022-11-28 19:18:46 -0500 | [diff] [blame] | 275 | useEffect(() => { |
| 276 | navigate('.', { |
| 277 | replace: true, |
| 278 | state: {}, |
| 279 | }); |
| 280 | }, [navigate]); |
| 281 | |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 282 | if (!callRole || callStatus === undefined) { |
| 283 | console.error('Invalid route. Redirecting...'); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 284 | return <Navigate to={'/'} />; |
| 285 | } |
| 286 | |
| 287 | return ( |
| 288 | <CallContext.Provider |
| 289 | value={{ |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 290 | isAudioOn, |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 291 | setIsAudioOn, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 292 | isVideoOn, |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 293 | setIsVideoOn, |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 294 | isChatShown, |
| 295 | setIsChatShown, |
simon | 2a5cf14 | 2022-11-25 15:47:35 -0500 | [diff] [blame] | 296 | isFullscreen, |
| 297 | setIsFullscreen, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 298 | callRole, |
| 299 | callStatus, |
Gabriel Rochon | e382a30 | 2022-11-23 12:37:04 -0500 | [diff] [blame] | 300 | callStartTime, |
Charlie | c444ab7 | 2022-11-29 18:24:27 -0500 | [diff] [blame] | 301 | isAnswerButtonDisabled, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 302 | acceptCall, |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 303 | endCall, |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 304 | }} |
| 305 | > |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 306 | {callStatus === CallStatus.PermissionsDenied ? <CallPermissionDenied /> : children} |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 307 | </CallContext.Provider> |
| 308 | ); |
| 309 | }; |