Provide speakerHeight to ringrtc

This commit is contained in:
Fedor Indutny 2022-09-07 08:52:55 -07:00 committed by Fedor Indutnyy
parent 618a7725fe
commit 55a5c51236
7 changed files with 29 additions and 11 deletions

View file

@ -178,10 +178,11 @@ const ActiveCallManager: React.FC<ActiveCallManagerPropsType> = ({
); );
const setGroupCallVideoRequestForConversation = useCallback( const setGroupCallVideoRequestForConversation = useCallback(
(resolutions: Array<GroupCallVideoRequest>) => { (resolutions: Array<GroupCallVideoRequest>, speakerHeight: number) => {
setGroupCallVideoRequest({ setGroupCallVideoRequest({
conversationId: conversation.id, conversationId: conversation.id,
resolutions, resolutions,
speakerHeight,
}); });
}, },
[setGroupCallVideoRequest, conversation.id] [setGroupCallVideoRequest, conversation.id]

View file

@ -56,7 +56,10 @@ export type PropsType = {
joinedAt?: number; joinedAt?: number;
me: ConversationType; me: ConversationType;
openSystemPreferencesAction: () => unknown; openSystemPreferencesAction: () => unknown;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void; setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
setLocalAudio: (_: SetLocalAudioType) => void; setLocalAudio: (_: SetLocalAudioType) => void;
setLocalVideo: (_: SetLocalVideoType) => void; setLocalVideo: (_: SetLocalVideoType) => void;
setLocalPreview: (_: SetLocalPreviewType) => void; setLocalPreview: (_: SetLocalPreviewType) => void;

View file

@ -54,7 +54,10 @@ export type PropsType = {
hangUpActiveCall: (reason: string) => void; hangUpActiveCall: (reason: string) => void;
hasLocalVideo: boolean; hasLocalVideo: boolean;
i18n: LocalizerType; i18n: LocalizerType;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void; setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
setLocalPreview: (_: SetLocalPreviewType) => void; setLocalPreview: (_: SetLocalPreviewType) => void;
setRendererCanvas: (_: SetRendererCanvasType) => void; setRendererCanvas: (_: SetRendererCanvasType) => void;
switchToPresentationView: () => void; switchToPresentationView: () => void;

View file

@ -76,7 +76,10 @@ export type PropsType = {
activeCall: ActiveCallType; activeCall: ActiveCallType;
getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource; getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource;
i18n: LocalizerType; i18n: LocalizerType;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void; setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
setRendererCanvas: (_: SetRendererCanvasType) => void; setRendererCanvas: (_: SetRendererCanvasType) => void;
}; };
@ -124,11 +127,13 @@ export const CallingPipRemoteVideo = ({
}; };
} }
return nonRenderedRemoteParticipant(participant); return nonRenderedRemoteParticipant(participant);
}) }),
PIP_VIDEO_HEIGHT_PX
); );
} else { } else {
setGroupCallVideoRequest( setGroupCallVideoRequest(
activeCall.remoteParticipants.map(nonRenderedRemoteParticipant) activeCall.remoteParticipants.map(nonRenderedRemoteParticipant),
0
); );
} }
}, [ }, [

View file

@ -48,7 +48,10 @@ type PropsType = {
i18n: LocalizerType; i18n: LocalizerType;
isInSpeakerView: boolean; isInSpeakerView: boolean;
remoteParticipants: ReadonlyArray<GroupCallRemoteParticipantType>; remoteParticipants: ReadonlyArray<GroupCallRemoteParticipantType>;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void; setGroupCallVideoRequest: (
_: Array<GroupCallVideoRequest>,
speakerHeight: number
) => void;
remoteAudioLevels: Map<number, number>; remoteAudioLevels: Map<number, number>;
}; };
@ -377,7 +380,7 @@ export const GroupCallRemoteParticipants: React.FC<PropsType> = ({
break; break;
} }
setGroupCallVideoRequest(videoRequest); setGroupCallVideoRequest(videoRequest, gridParticipantHeight);
}, [ }, [
devicePixelRatio, devicePixelRatio,
gridParticipantHeight, gridParticipantHeight,

View file

@ -830,9 +830,10 @@ export class CallingClass {
public setGroupCallVideoRequest( public setGroupCallVideoRequest(
conversationId: string, conversationId: string,
resolutions: Array<VideoRequest> resolutions: Array<VideoRequest>,
speakerHeight: number
): void { ): void {
this.getGroupCall(conversationId)?.requestVideo(resolutions, 0); this.getGroupCall(conversationId)?.requestVideo(resolutions, speakerHeight);
} }
public groupMembersChanged(conversationId: string): void { public groupMembersChanged(conversationId: string): void {

View file

@ -227,6 +227,7 @@ export type SetLocalVideoType = {
export type SetGroupCallVideoRequestType = { export type SetGroupCallVideoRequestType = {
conversationId: string; conversationId: string;
resolutions: Array<GroupCallVideoRequest>; resolutions: Array<GroupCallVideoRequest>;
speakerHeight: number;
}; };
export type StartCallingLobbyType = { export type StartCallingLobbyType = {
@ -1146,7 +1147,8 @@ function setGroupCallVideoRequest(
// The `framerate` property in RingRTC has to be set, even if it's set to // The `framerate` property in RingRTC has to be set, even if it's set to
// `undefined`. // `undefined`.
framerate: undefined, framerate: undefined,
})) })),
payload.speakerHeight
); );
}; };
} }