Use missingCaseError in <CallingPipRemoteVideo>

This commit is contained in:
Evan Hahn 2021-03-03 11:23:00 -06:00 committed by Josh Perez
parent 8c951602b7
commit 99bcad0bd9

View file

@ -18,6 +18,7 @@ import {
import { SetRendererCanvasType } from '../state/ducks/calling'; import { SetRendererCanvasType } from '../state/ducks/calling';
import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer'; import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer';
import { usePageVisibility } from '../util/hooks'; import { usePageVisibility } from '../util/hooks';
import { missingCaseError } from '../util/missingCaseError';
import { nonRenderedRemoteParticipant } from '../util/ringrtc/nonRenderedRemoteParticipant'; import { nonRenderedRemoteParticipant } from '../util/ringrtc/nonRenderedRemoteParticipant';
// This value should be kept in sync with the hard-coded CSS height. // This value should be kept in sync with the hard-coded CSS height.
@ -131,42 +132,39 @@ export const CallingPipRemoteVideo = ({
setGroupCallVideoRequest, setGroupCallVideoRequest,
]); ]);
if (activeCall.callMode === CallMode.Direct) { switch (activeCall.callMode) {
const { hasRemoteVideo } = activeCall.remoteParticipants[0]; case CallMode.Direct: {
const { hasRemoteVideo } = activeCall.remoteParticipants[0];
if (!hasRemoteVideo) { if (!hasRemoteVideo) {
return <NoVideo activeCall={activeCall} i18n={i18n} />; return <NoVideo activeCall={activeCall} i18n={i18n} />;
}
return (
<div className="module-calling-pip__video--remote">
<DirectCallRemoteParticipant
conversation={conversation}
hasRemoteVideo={hasRemoteVideo}
i18n={i18n}
setRendererCanvas={setRendererCanvas}
/>
</div>
);
} }
case CallMode.Group:
return ( if (!activeGroupCallSpeaker) {
<div className="module-calling-pip__video--remote"> return <NoVideo activeCall={activeCall} i18n={i18n} />;
<DirectCallRemoteParticipant }
conversation={conversation} return (
hasRemoteVideo={hasRemoteVideo} <div className="module-calling-pip__video--remote">
i18n={i18n} <GroupCallRemoteParticipant
setRendererCanvas={setRendererCanvas} getFrameBuffer={getGroupCallFrameBuffer}
/> getGroupCallVideoFrameSource={getGroupCallVideoFrameSource}
</div> i18n={i18n}
); isInPip
remoteParticipant={activeGroupCallSpeaker}
/>
</div>
);
default:
throw missingCaseError(activeCall);
} }
if (activeCall.callMode === CallMode.Group) {
if (!activeGroupCallSpeaker) {
return <NoVideo activeCall={activeCall} i18n={i18n} />;
}
return (
<div className="module-calling-pip__video--remote">
<GroupCallRemoteParticipant
getFrameBuffer={getGroupCallFrameBuffer}
getGroupCallVideoFrameSource={getGroupCallVideoFrameSource}
i18n={i18n}
isInPip
remoteParticipant={activeGroupCallSpeaker}
/>
</div>
);
}
throw new Error('CallingRemoteVideo: Unknown Call Mode');
}; };