Hide speaking border when presenting/1:1 in group

This commit is contained in:
Jamie Kyle 2023-03-22 10:53:13 -07:00 committed by GitHub
parent fc161a67df
commit f272433b7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 14 deletions

View file

@ -171,6 +171,7 @@ export function CallingPipRemoteVideo({
i18n={i18n} i18n={i18n}
isInPip isInPip
remoteParticipant={activeGroupCallSpeaker} remoteParticipant={activeGroupCallSpeaker}
remoteParticipantsCount={activeCall.remoteParticipants.length}
/> />
</div> </div>
); );

View file

@ -40,6 +40,7 @@ const defaultProps = {
i18n, i18n,
onParticipantVisibilityChanged: action('onParticipantVisibilityChanged'), onParticipantVisibilityChanged: action('onParticipantVisibilityChanged'),
remoteAudioLevels: new Map<number, number>(), remoteAudioLevels: new Map<number, number>(),
remoteParticipantsCount: 1,
}; };
// This component is usually rendered on a call screen. // This component is usually rendered on a call screen.

View file

@ -25,6 +25,7 @@ type PropsType = {
) => unknown; ) => unknown;
overflowedParticipants: ReadonlyArray<GroupCallRemoteParticipantType>; overflowedParticipants: ReadonlyArray<GroupCallRemoteParticipantType>;
remoteAudioLevels: Map<number, number>; remoteAudioLevels: Map<number, number>;
remoteParticipantsCount: number;
}; };
export function GroupCallOverflowArea({ export function GroupCallOverflowArea({
@ -34,6 +35,7 @@ export function GroupCallOverflowArea({
onParticipantVisibilityChanged, onParticipantVisibilityChanged,
overflowedParticipants, overflowedParticipants,
remoteAudioLevels, remoteAudioLevels,
remoteParticipantsCount,
}: PropsType): JSX.Element | null { }: PropsType): JSX.Element | null {
const overflowRef = useRef<HTMLDivElement | null>(null); const overflowRef = useRef<HTMLDivElement | null>(null);
const [overflowScrollTop, setOverflowScrollTop] = useState(0); const [overflowScrollTop, setOverflowScrollTop] = useState(0);
@ -123,6 +125,7 @@ export function GroupCallOverflowArea({
OVERFLOW_PARTICIPANT_WIDTH / remoteParticipant.videoAspectRatio OVERFLOW_PARTICIPANT_WIDTH / remoteParticipant.videoAspectRatio
)} )}
remoteParticipant={remoteParticipant} remoteParticipant={remoteParticipant}
remoteParticipantsCount={remoteParticipantsCount}
/> />
))} ))}
</div> </div>

View file

@ -16,6 +16,7 @@ const i18n = setupI18n('en', enMessages);
type OverridePropsType = { type OverridePropsType = {
audioLevel?: number; audioLevel?: number;
remoteParticipantsCount?: number;
} & ( } & (
| { | {
isInPip: true; isInPip: true;
@ -36,9 +37,11 @@ const createProps = (
{ {
isBlocked = false, isBlocked = false,
hasRemoteAudio = false, hasRemoteAudio = false,
presenting = false,
}: { }: {
isBlocked?: boolean; isBlocked?: boolean;
hasRemoteAudio?: boolean; hasRemoteAudio?: boolean;
presenting?: boolean;
} = {} } = {}
): PropsType => ({ ): PropsType => ({
getFrameBuffer, getFrameBuffer,
@ -50,7 +53,7 @@ const createProps = (
demuxId: 123, demuxId: 123,
hasRemoteAudio, hasRemoteAudio,
hasRemoteVideo: true, hasRemoteVideo: true,
presenting: false, presenting,
sharingScreen: false, sharingScreen: false,
videoAspectRatio: 1.3, videoAspectRatio: 1.3,
...getDefaultConversation({ ...getDefaultConversation({
@ -60,6 +63,7 @@ const createProps = (
uuid: '992ed3b9-fc9b-47a9-bdb4-e0c7cbb0fda5', uuid: '992ed3b9-fc9b-47a9-bdb4-e0c7cbb0fda5',
}), }),
}, },
remoteParticipantsCount: 1,
...overrideProps, ...overrideProps,
}); });
@ -82,20 +86,30 @@ export function Default(): JSX.Element {
} }
export function Speaking(): JSX.Element { export function Speaking(): JSX.Element {
return ( function createSpeakingProps(
<GroupCallRemoteParticipant index: number,
{...createProps( remoteParticipantsCount: number,
presenting: boolean
) {
return createProps(
{ {
isInPip: false, isInPip: false,
height: 120, height: 120,
left: 0, left: (120 + 10) * index,
top: 0, top: 0,
width: 120, width: 120,
audioLevel: select('audioLevel', [0, 0.5, 1], 0.5), audioLevel: select('audioLevel', [0, 0.5, 1], 0.5),
remoteParticipantsCount,
}, },
{ hasRemoteAudio: true } { hasRemoteAudio: true, presenting }
)} );
/> }
return (
<>
<GroupCallRemoteParticipant {...createSpeakingProps(0, 1, false)} />
<GroupCallRemoteParticipant {...createSpeakingProps(1, 2, false)} />
<GroupCallRemoteParticipant {...createSpeakingProps(2, 2, true)} />
</>
); );
} }

View file

@ -37,6 +37,7 @@ type BasePropsType = {
i18n: LocalizerType; i18n: LocalizerType;
onVisibilityChanged?: (demuxId: number, isVisible: boolean) => unknown; onVisibilityChanged?: (demuxId: number, isVisible: boolean) => unknown;
remoteParticipant: GroupCallRemoteParticipantType; remoteParticipant: GroupCallRemoteParticipantType;
remoteParticipantsCount: number;
}; };
type InPipPropsType = { type InPipPropsType = {
@ -65,6 +66,7 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
getGroupCallVideoFrameSource, getGroupCallVideoFrameSource,
i18n, i18n,
onVisibilityChanged, onVisibilityChanged,
remoteParticipantsCount,
} = props; } = props;
const { const {
@ -81,6 +83,7 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
sharingScreen, sharingScreen,
title, title,
videoAspectRatio, videoAspectRatio,
presenting,
} = props.remoteParticipant; } = props.remoteParticipant;
const isSpeaking = useValueAtFixedRate( const isSpeaking = useValueAtFixedRate(
@ -278,6 +281,8 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
className={classNames( className={classNames(
'module-ongoing-call__group-call-remote-participant', 'module-ongoing-call__group-call-remote-participant',
isSpeaking && isSpeaking &&
!presenting &&
remoteParticipantsCount > 1 &&
'module-ongoing-call__group-call-remote-participant--speaking' 'module-ongoing-call__group-call-remote-participant--speaking'
)} )}
ref={intersectionRef} ref={intersectionRef}

View file

@ -295,6 +295,7 @@ export function GroupCallRemoteParticipants({
remoteParticipant={remoteParticipant} remoteParticipant={remoteParticipant}
top={top} top={top}
width={renderedWidth} width={renderedWidth}
remoteParticipantsCount={remoteParticipants.length}
/> />
); );
}); });
@ -438,6 +439,7 @@ export function GroupCallRemoteParticipants({
onParticipantVisibilityChanged={onParticipantVisibilityChanged} onParticipantVisibilityChanged={onParticipantVisibilityChanged}
overflowedParticipants={overflowedParticipants} overflowedParticipants={overflowedParticipants}
remoteAudioLevels={remoteAudioLevels} remoteAudioLevels={remoteAudioLevels}
remoteParticipantsCount={remoteParticipants.length}
/> />
</div> </div>
)} )}