Skip to content

Commit 38e58a8

Browse files
Move width/height calculation on call page for Video Gallery (#5777)
* Move width/height calculation on call page * Change files * Update packages/react-composites CallWithChatComposite browser test snapshots * Update packages/react-composites CallWithChatComposite browser test snapshots * update * Update packages/react-composites CallWithChatComposite browser test snapshots * Update packages/react-composites CallWithChatComposite browser test snapshots * Update packages/react-composites CallComposite browser test snapshots * Update packages/react-composites CallComposite browser test snapshots --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent eeb9eba commit 38e58a8

12 files changed

Lines changed: 41 additions & 12 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Fix bug where mobile video gallery shows landscape view when RTT banner is enlarged",
5+
"comment": "Fix bug where mobile video gallery shows landscape view when RTT banner is enlarged",
6+
"packageName": "@azure/communication-react",
7+
"email": "96077406+carocao-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Fix bug where mobile video gallery shows landscape view when RTT banner is enlarged",
5+
"comment": "Fix bug where mobile video gallery shows landscape view when RTT banner is enlarged",
6+
"packageName": "@azure/communication-react",
7+
"email": "96077406+carocao-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

packages/react-composites/src/composites/CallComposite/components/MediaGallery.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import React, { CSSProperties, useCallback, useMemo } from 'react';
5-
import { useRef } from 'react';
4+
import React, { CSSProperties, useCallback, useMemo, useRef } from 'react';
65
import {
76
VideoGallery,
87
VideoStreamOptions,
@@ -71,6 +70,7 @@ export interface MediaGalleryProps {
7170
height: 'full' | 'default';
7271
};
7372
localScreenShareView?: LocalScreenShareView;
73+
compositeContainerAspectRatio?: number;
7474
}
7575

7676
/**
@@ -84,7 +84,8 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
8484
setPromptProps,
8585
hideSpotlightButtons,
8686
videoTilesOptions,
87-
captionsOptions
87+
captionsOptions,
88+
compositeContainerAspectRatio
8889
} = props;
8990

9091
const videoGalleryProps = usePropsFor(VideoGallery);
@@ -95,12 +96,11 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
9596
const userRole = useSelector(getRole);
9697
const capabilities = useSelector(getCapabilites);
9798
const isRoomsCall = useSelector(getIsRoomsCall);
99+
const reactionResources = useSelector(getReactionResources);
98100

99101
const containerRef = useRef<HTMLDivElement>(null);
100102
const containerWidth = _useContainerWidth(containerRef);
101103
const containerHeight = _useContainerHeight(containerRef);
102-
const containerAspectRatio = containerWidth && containerHeight ? containerWidth / containerHeight : 0;
103-
const reactionResources = useSelector(getReactionResources);
104104

105105
const layoutBasedOnTilePosition: VideoGalleryLayout = getVideoGalleryLayoutBasedOnLocalOptions(
106106
(props.localVideoTileOptions as LocalVideoTileOptions)?.position
@@ -209,7 +209,7 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
209209
localVideoTileSize={
210210
props.localVideoTileOptions === false || userRole === 'Consumer' || (isRoomsCall && userRole === 'Unknown')
211211
? 'hidden'
212-
: props.isMobile && containerAspectRatio < 1
212+
: props.isMobile && compositeContainerAspectRatio && compositeContainerAspectRatio < 1
213213
? '9:16'
214214
: '16:9'
215215
}
@@ -242,7 +242,6 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
242242
overflowGalleryPosition,
243243
userRole,
244244
isRoomsCall,
245-
containerAspectRatio,
246245
pinnedParticipants,
247246
onPinParticipant,
248247
onUnpinParticipant,
@@ -254,7 +253,8 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
254253
onStopRemoteSpotlightWithPrompt,
255254
layoutBasedOnTilePosition,
256255
capabilities?.muteOthers,
257-
props.localScreenShareView
256+
props.localScreenShareView,
257+
compositeContainerAspectRatio
258258
]);
259259

260260
return (

packages/react-composites/src/composites/CallComposite/pages/CallPage.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44
import { DiagnosticQuality } from '@azure/communication-calling';
55
import { useId } from '@fluentui/react-hooks';
66
import { _isInCall } from '@internal/calling-component-bindings';
7-
import { ActiveErrorMessage, ErrorBar, ParticipantMenuItemsCallback } from '@internal/react-components';
7+
import {
8+
_useContainerHeight,
9+
_useContainerWidth,
10+
ActiveErrorMessage,
11+
ErrorBar,
12+
ParticipantMenuItemsCallback
13+
} from '@internal/react-components';
814
import { CustomAvatarOptions, VideoTile } from '@internal/react-components';
915

1016
import { ActiveNotification } from '@internal/react-components';
1117
import { VideoGalleryLayout } from '@internal/react-components';
12-
import React, { useMemo } from 'react';
18+
import React, { useMemo, useRef } from 'react';
1319
import { useCallback } from 'react';
1420
import { useState } from 'react';
1521
import { AvatarPersonaDataCallback } from '../../common/AvatarPersona';
@@ -108,6 +114,10 @@ export const CallPage = (props: CallPageProps): JSX.Element => {
108114
const [dtmfDialerPresent, setDtmfDialerPresent] = useState<boolean>(renderDtmfDialerFromStart);
109115
const isPstnCall = callees?.some((callee) => isPhoneNumberIdentifier(callee));
110116
const isCTECall = useSelector((state) => state.userId.kind === 'microsoftTeamsUser');
117+
const containerRef = useRef<HTMLDivElement>(null);
118+
const containerWidth = _useContainerWidth(containerRef);
119+
const containerHeight = _useContainerHeight(containerRef);
120+
const containerAspectRatio = containerWidth && containerHeight ? containerWidth / containerHeight : 0;
111121

112122
const strings = useLocale().strings.call;
113123

@@ -196,13 +206,14 @@ export const CallPage = (props: CallPageProps): JSX.Element => {
196206
videoTilesOptions={options?.videoTilesOptions}
197207
captionsOptions={options?.captionsBanner}
198208
localScreenShareView={options?.galleryOptions?.localScreenShareView}
209+
compositeContainerAspectRatio={containerAspectRatio}
199210
/>
200211
);
201212
}
202213
};
203214

204215
return (
205-
<>
216+
<div ref={containerRef} style={{ height: '100%', width: '100%' }}>
206217
<CallArrangement
207218
id={drawerMenuHostId}
208219
complianceBannerProps={{ ...complianceBannerProps, strings }}
@@ -256,7 +267,7 @@ export const CallPage = (props: CallPageProps): JSX.Element => {
256267
isRTTSupportedCall={!isPstnCall && !isCTECall}
257268
/>
258269
{<Prompt isOpen={isPromptOpen} onDismiss={() => setIsPromptOpen(false)} {...promptProps} />}
259-
</>
270+
</div>
260271
);
261272
};
262273

Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)