Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
8045b2b
Added overflowGalleryLayout prop to VideoGallery to control component…
mgamis-msft Feb 23, 2023
2b9afd9
Refactor FloatingLocalVideo props
mgamis-msft Feb 23, 2023
cb021f1
renamed VideoGalleryResponsiveHorizontalGallery -> OverflowGallery
mgamis-msft Feb 24, 2023
bb23576
Change files
mgamis-msft Feb 24, 2023
a391f08
Duplicate change files for beta release
mgamis-msft Feb 24, 2023
0bf6631
remove ScrollableHorizontalGallery from DefaultLayout
mgamis-msft Feb 24, 2023
a61003b
lint fix
mgamis-msft Feb 24, 2023
2ea4f1d
overflowGalleryLayout = 'HorizontalBottom' as default for VIdeoGallery
mgamis-msft Feb 24, 2023
e8ac45c
Merge branch 'main' into mgamis/overflowGalleryLayout-prop
dmceachernmsft Feb 24, 2023
4612708
update CSS for proper button placement.
dmceachernmsft Feb 24, 2023
0c39159
update css for larger page counts
dmceachernmsft Feb 24, 2023
fc0db35
fix up styles bottom out control bar
dmceachernmsft Feb 25, 2023
51c6510
Change files
dmceachernmsft Feb 25, 2023
9ba8ced
Duplicate change files for beta release
dmceachernmsft Feb 25, 2023
29dd33f
memoize styles in verticalGallery
dmceachernmsft Feb 25, 2023
3059907
update style name
dmceachernmsft Feb 25, 2023
c95cedc
fix lint
dmceachernmsft Feb 25, 2023
5eb87cf
update per comments
dmceachernmsft Feb 27, 2023
9ffe0ac
Observe width and height of MediaGallery to switch between horizontal…
mgamis-msft Feb 27, 2023
0aff392
Merge branch 'main' into mgamis/call-composite-overflow-gallery
mgamis-msft Feb 28, 2023
bcce827
Change files
mgamis-msft Feb 28, 2023
9b246a5
Duplicate change files for beta release
mgamis-msft Feb 28, 2023
059c8e1
> changed to >=
mgamis-msft Feb 28, 2023
2ba0bc0
Fix local video tile size logic
mgamis-msft Mar 1, 2023
4feaa62
let -> const
mgamis-msft Mar 1, 2023
de13038
fix floating local video tile size logic
mgamis-msft Mar 1, 2023
cf60a7a
viewport adjusted in horizontal gallery snapshot tests
mgamis-msft Mar 1, 2023
1a292b2
Update packages/react-composites CallComposite browser test snapshots
github-actions[bot] Mar 1, 2023
5a61afe
viewport adjusted in horizontal gallery snapshot tests for Desktop only
mgamis-msft Mar 1, 2023
2f78fc8
Update packages/react-composites CallComposite browser test snapshots
github-actions[bot] Mar 1, 2023
9244691
Merge branch 'main' into mgamis/call-composite-overflow-gallery
dmceachernmsft Mar 1, 2023
a9a8e5c
Merge branch 'main' into mgamis/call-composite-overflow-gallery
dmceachernmsft Mar 1, 2023
354328d
update so optimize for mobile
dmceachernmsft Mar 1, 2023
cc61460
Added playwright config project to test vertical gallery and horizont…
mgamis-msft Mar 1, 2023
b773deb
Change files
mgamis-msft Mar 1, 2023
489aaba
Duplicate change files for beta release
mgamis-msft Mar 1, 2023
66525fe
test.use to assign viewport to HorizontalGallery snapshot tests
mgamis-msft Mar 2, 2023
4d6eb0c
remove unused variable
mgamis-msft Mar 2, 2023
829f1da
lint fix
mgamis-msft Mar 2, 2023
871405f
use testMatch and testIgnore for HorizontalGallery.test.ts
mgamis-msft Mar 2, 2023
68f4a4a
Merge branch 'mgamis/new-playwright-test-project-for-desktop' into mg…
mgamis-msft Mar 2, 2023
3d4b5b1
Revert changes to HorizontalGallery.test.ts
mgamis-msft Mar 2, 2023
9cb8d84
shorten name project name
mgamis-msft Mar 2, 2023
ae82886
Update packages/react-composites CallComposite browser test snapshots
github-actions[bot] Mar 2, 2023
35f4b61
Changed HorizontalGallery button identifiers to be more generic
mgamis-msft Mar 2, 2023
8422e5e
stable api update
mgamis-msft Mar 2, 2023
b5a5b21
Merge branch 'main' into mgamis/call-composite-overflow-gallery
mgamis-msft Mar 2, 2023
eada437
Merge branch 'main' into mgamis/call-composite-overflow-gallery
mgamis-msft Mar 3, 2023
60787c4
Update packages/react-composites CallComposite browser test snapshots
github-actions[bot] Mar 3, 2023
791dfb7
hermetic IDS fixed
mgamis-msft Mar 3, 2023
655cc87
delete unused snapshot
mgamis-msft Mar 3, 2023
4720a1b
delete unused stable flavor snapshots
mgamis-msft Mar 3, 2023
1d9e34b
Merge branch 'main' into mgamis/call-composite-overflow-gallery
mgamis-msft Mar 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "VideoGallery in call composite will use a vertical overflow gallery when its aspect ratio is 16:9 or greater.",
"packageName": "@azure/communication-react",
"email": "79475487+mgamis-msft@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "VideoGallery in call composite will use a vertical overflow gallery when its aspect ratio is 16:9 or greater.",
"packageName": "@azure/communication-react",
"email": "79475487+mgamis-msft@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,20 @@ export const FloatingLocalVideoLayout = (props: FloatingLocalVideoLayoutProps):

const layerHostId = useId('layerhost');

let localVideoSize = LARGE_FLOATING_MODAL_SIZE_PX;
if (isNarrow) {
localVideoSize = SMALL_FLOATING_MODAL_SIZE_PX;
}
/* @conditional-compile-remove(vertical-gallery) */
if (overflowGalleryLayout === 'VerticalRight') {
localVideoSize = VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX;
}
const localVideoSize = useMemo(() => {
if (isNarrow) {
return SMALL_FLOATING_MODAL_SIZE_PX;
}
/* @conditional-compile-remove(vertical-gallery) */
if (horizontalGalleryTiles.length > 0 && overflowGalleryLayout === 'VerticalRight') {
return isNarrow ? SMALL_FLOATING_MODAL_SIZE_PX : VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX;
}
return LARGE_FLOATING_MODAL_SIZE_PX;
}, [
horizontalGalleryTiles.length,
isNarrow,
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout
]);

const wrappedLocalVideoComponent =
localVideoComponent && shouldFloatLocalVideo ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const OverflowGallery = (props: {
const containerStyles = useMemo(() => {
/* @conditional-compile-remove(vertical-gallery) */
if (overflowGalleryLayout === 'VerticalRight') {
return verticalGalleryContainerStyle(shouldFloatLocalVideo);
return verticalGalleryContainerStyle(shouldFloatLocalVideo, isNarrow);
}
return horizontalGalleryContainerStyle(shouldFloatLocalVideo, isNarrow);
}, [shouldFloatLocalVideo, isNarrow, /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { IStyle } from '@fluentui/react';
import { _pxToRem } from '@internal/acs-ui-common';
import { VerticalGalleryStyles } from '../../VerticalGallery';
import { VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX } from './FloatingLocalVideo.styles';
import { SMALL_FLOATING_MODAL_SIZE_PX, VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX } from './FloatingLocalVideo.styles';

/**
* VerticalGallery tile size in rem:
Expand All @@ -24,12 +24,20 @@ export const VERTICAL_GALLERY_TILE_SIZE_REM = { minHeight: 5.625, maxHeight: 9,
* @param shouldFloatLocalVideo whether rendered in floating layout or not
* @returns Style set for VerticalGallery container.
*/
export const verticalGalleryContainerStyle = (shouldFloatLocalVideo: boolean): IStyle => {
return {
width: `${VERTICAL_GALLERY_TILE_SIZE_REM.width}rem`,
height: shouldFloatLocalVideo ? `calc(100% - ${_pxToRem(VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX.height)})` : '100%',
paddingBottom: '0.5rem'
};
export const verticalGalleryContainerStyle = (shouldFloatLocalVideo: boolean, isNarrow: boolean): IStyle => {
return isNarrow
? {
width: `${VERTICAL_GALLERY_TILE_SIZE_REM.width}rem`,
height: shouldFloatLocalVideo ? `calc(100% - ${_pxToRem(SMALL_FLOATING_MODAL_SIZE_PX.height)})` : '100%',
paddingBottom: '0.5rem'
}
: {
width: `${VERTICAL_GALLERY_TILE_SIZE_REM.width}rem`,
height: shouldFloatLocalVideo
? `calc(100% - ${_pxToRem(VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX.height)})`
: '100%',
paddingBottom: '0.5rem'
};
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import React, { useCallback, useEffect, useMemo, useState } from 'react';
import React, { CSSProperties, useCallback, useEffect, useMemo, useState } from 'react';
/* @conditional-compile-remove(vertical-gallery) */
import { useRef } from 'react';
import {
VideoGallery,
VideoStreamOptions,
OnRenderAvatarCallback,
CustomAvatarOptions,
Announcer
} from '@internal/react-components';
/* @conditional-compile-remove(vertical-gallery) */
import { _useContainerWidth, _useContainerHeight } from '@internal/react-components';
/* @conditional-compile-remove(pinned-participants) */
import { VideoTileContextualMenuProps, VideoTileDrawerMenuProps } from '@internal/react-components';
import { usePropsFor } from '../hooks/usePropsFor';
Expand Down Expand Up @@ -65,6 +69,13 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
const cameraSwitcherCallback = useHandlers(LocalVideoCameraCycleButton);
const announcerString = useParticipantChangedAnnouncement();

/* @conditional-compile-remove(vertical-gallery) */
const containerRef = useRef<HTMLDivElement>(null);
/* @conditional-compile-remove(vertical-gallery) */
const containerWidth = _useContainerWidth(containerRef);
/* @conditional-compile-remove(vertical-gallery) */
const containerHeight = _useContainerHeight(containerRef);

const cameraSwitcherProps = useMemo(() => {
return {
...cameraSwitcherCallback,
Expand Down Expand Up @@ -96,6 +107,15 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
: { kind: 'contextual' };
}, [props.remoteVideoTileMenuOptions?.isHidden, props.isMobile, props.drawerMenuHostId]);

/* @conditional-compile-remove(vertical-gallery) */
const overflowGalleryLayout = useMemo(
() =>
containerWidth && containerHeight && containerWidth / containerHeight >= 16 / 9
? 'VerticalRight'
: 'HorizontalBottom',
[containerWidth, containerHeight]
);

const VideoGalleryMemoized = useMemo(() => {
return (
<VideoGallery
Expand All @@ -109,21 +129,24 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
onRenderAvatar={onRenderAvatar}
/* @conditional-compile-remove(pinned-participants) */
remoteVideoTileMenuOptions={remoteVideoTileMenuOptions}
/* @conditional-compile-remove(vertical-gallery) */
overflowGalleryLayout={overflowGalleryLayout}
/>
);
}, [
videoGalleryProps,
props.isMobile,
onRenderAvatar,
cameraSwitcherProps,
/* @conditional-compile-remove(pinned-participants) */ remoteVideoTileMenuOptions
/* @conditional-compile-remove(pinned-participants) */ remoteVideoTileMenuOptions,
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout
]);

return (
<>
<div /* @conditional-compile-remove(vertical-gallery) */ ref={containerRef} style={mediaGalleryContainerStyles}>
<Announcer announcementString={announcerString} ariaLive={'polite'} />
{VideoGalleryMemoized}
</>
</div>
);
};

Expand Down Expand Up @@ -153,3 +176,5 @@ export const useLocalVideoStartTrigger = (isLocalVideoAvailable: boolean, should
}
}, [shouldTransition, isButtonStatusSynced, isPreviewCameraOn, isLocalVideoAvailable, mediaGalleryHandlers]);
};

const mediaGalleryContainerStyles: CSSProperties = { width: '100%', height: '100%' };
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@

import { expect } from '@playwright/test';
import { IDS } from '../../common/constants';
import { dataUiId, dragToRight, existsOnPage, pageClick, stableScreenshot, waitForSelector } from '../../common/utils';
import {
dataUiId,
dragToRight,
existsOnPage,
isTestProfileDesktop,
pageClick,
stableScreenshot,
waitForSelector
} from '../../common/utils';
import {
addScreenshareStream,
addVideoStream,
Expand All @@ -15,6 +23,13 @@ import {
} from './fixture';

test.describe('HorizontalGallery tests', async () => {
// set view port to 1:1 aspect ratio to ensure 'HorizontalBottom' overflowGalleryLayout is used for VideoGallery on Desktop
test.beforeEach(async ({ page }, testInfo) => {
if (isTestProfileDesktop(testInfo)) {
page.setViewportSize({ width: 900, height: 900 });
}
});

test('HorizontalGallery should have 1 audio participant', async ({ page, serverUrl }) => {
const paul = defaultMockRemoteParticipant('Paul Bridges');
addVideoStream(paul, true);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.