diff --git a/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx b/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx index c070c3b50..ec61f6bd6 100644 --- a/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx +++ b/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx @@ -17,7 +17,9 @@ export interface Props { function ChatWindow({ userId, incomeStream, localStream, endCall, isPrestart }: Props) { const [localVideoEnabled, setLocalVideoEnabled] = useState(false) + const [anyRemoteEnabled, setRemoteEnabled] = useState(false) + const onlyLocalEnabled = localVideoEnabled && !anyRemoteEnabled return (
-
+
{incomeStream - ? incomeStream.map(stream => ) : ( + ? incomeStream.map(stream => ) : (
Error obtaining incoming streams
)}
- +
diff --git a/frontend/app/components/Assist/components/VideoContainer/VideoContainer.tsx b/frontend/app/components/Assist/components/VideoContainer/VideoContainer.tsx index bff02fb0c..7b64821b0 100644 --- a/frontend/app/components/Assist/components/VideoContainer/VideoContainer.tsx +++ b/frontend/app/components/Assist/components/VideoContainer/VideoContainer.tsx @@ -3,10 +3,11 @@ import React, { useEffect, useRef } from 'react' interface Props { stream: MediaStream | null muted?: boolean, - height?: number + height?: number, + setRemoteEnabled?: (isEnabled: boolean) => void } -function VideoContainer({ stream, muted = false, height = 280 }: Props) { +function VideoContainer({ stream, muted = false, height = 280, setRemoteEnabled }: Props) { const ref = useRef(null); const [isEnabled, setEnabled] = React.useState(false); @@ -22,7 +23,10 @@ function VideoContainer({ stream, muted = false, height = 280 }: Props) { const settings = stream.getVideoTracks()[0]?.getSettings() const isDummyVideoTrack = settings ? (settings.width === 2 || settings.frameRate === 0 || !settings.frameRate && !settings.width) : true const shouldBeEnabled = !isDummyVideoTrack - isEnabled !== shouldBeEnabled ? setEnabled(shouldBeEnabled) : null; + if (isEnabled !== shouldBeEnabled) { + setEnabled(shouldBeEnabled) + setRemoteEnabled?.(shouldBeEnabled) + } }, 500) return () => clearInterval(iid) }, [ stream, isEnabled ])