Don't request video for invisible group call participants
This commit is contained in:
parent
b4b65c4f00
commit
01549b11d1
7 changed files with 171 additions and 16 deletions
|
@ -29,6 +29,7 @@ type BasePropsType = {
|
|||
getFrameBuffer: () => ArrayBuffer;
|
||||
getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource;
|
||||
i18n: LocalizerType;
|
||||
onVisibilityChanged?: (demuxId: number, isVisible: boolean) => unknown;
|
||||
remoteParticipant: GroupCallRemoteParticipantType;
|
||||
};
|
||||
|
||||
|
@ -52,7 +53,12 @@ export type PropsType = BasePropsType &
|
|||
|
||||
export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
|
||||
props => {
|
||||
const { getFrameBuffer, getGroupCallVideoFrameSource, i18n } = props;
|
||||
const {
|
||||
getFrameBuffer,
|
||||
getGroupCallVideoFrameSource,
|
||||
i18n,
|
||||
onVisibilityChanged,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
acceptedMessageRequest,
|
||||
|
@ -95,6 +101,10 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
|
|||
? intersectionObserverEntry.isIntersecting
|
||||
: true;
|
||||
|
||||
useEffect(() => {
|
||||
onVisibilityChanged?.(demuxId, isVisible);
|
||||
}, [demuxId, isVisible, onVisibilityChanged]);
|
||||
|
||||
const wantsToShowVideo = hasRemoteVideo && !isBlocked && isVisible;
|
||||
const hasVideoToShow = wantsToShowVideo && hasReceivedVideoRecently;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue