@azure/communication-react 1.4.3-alpha-202212060013.0 → 1.4.3-alpha-202212070014.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist-cjs/communication-react/index.js +356 -220
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.d.ts +41 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +45 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/VideoGalleryResponsiveHorizontalGallery.d.ts +12 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/VideoGalleryResponsiveHorizontalGallery.js +18 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/VideoGalleryResponsiveHorizontalGallery.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/DefaultLayout.styles.d.ts +6 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/DefaultLayout.styles.js +9 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/DefaultLayout.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveHorizontalGallery.styles.d.ts +59 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveHorizontalGallery.styles.js +64 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveHorizontalGallery.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/videoGalleryUtils.d.ts +17 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/videoGalleryUtils.js +68 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/videoGalleryUtils.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +25 -17
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/package.json +8 -8
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.4.3-alpha-
|
1
|
+
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.4.3-alpha-202212070014.0';\n"]}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { VideoGalleryRemoteParticipant } from '../../types';
|
3
|
+
import { VideoGalleryStyles } from '../VideoGallery';
|
4
|
+
/**
|
5
|
+
* Props for {@link DefaultLayout}.
|
6
|
+
*
|
7
|
+
* @private
|
8
|
+
*/
|
9
|
+
export interface DefaultLayoutProps {
|
10
|
+
/**
|
11
|
+
* Styles for the {@link DefaultLayout}
|
12
|
+
*/
|
13
|
+
styles?: Omit<VideoGalleryStyles, 'root'>;
|
14
|
+
/** List of remote video particpants */
|
15
|
+
remoteParticipants?: VideoGalleryRemoteParticipant[];
|
16
|
+
/** Callback to render each remote participant */
|
17
|
+
onRenderRemoteParticipant: (participant: VideoGalleryRemoteParticipant, isVideoParticipant?: boolean) => JSX.Element;
|
18
|
+
/** List of dominant speaker userIds in the order of their dominance. 0th index is the most dominant. */
|
19
|
+
dominantSpeakers?: string[];
|
20
|
+
/** Component that contains local video content */
|
21
|
+
localVideoComponent?: JSX.Element;
|
22
|
+
/** Component that contains screen share content */
|
23
|
+
screenShareComponent?: JSX.Element;
|
24
|
+
/**
|
25
|
+
* Maximum number of participant remote video streams that is rendered.
|
26
|
+
* @defaultValue 4
|
27
|
+
*/
|
28
|
+
maxRemoteVideoStreams?: number;
|
29
|
+
/**
|
30
|
+
* Width of parent element
|
31
|
+
*/
|
32
|
+
parentWidth?: number;
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* DefaultLayout displays remote participants, local video component, and screen sharing component in
|
36
|
+
* a grid and horizontal gallery.
|
37
|
+
*
|
38
|
+
* @private
|
39
|
+
*/
|
40
|
+
export declare const DefaultLayout: (props: DefaultLayoutProps) => JSX.Element;
|
41
|
+
//# sourceMappingURL=DefaultLayout.d.ts.map
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
import { Stack } from '@fluentui/react';
|
4
|
+
import React from 'react';
|
5
|
+
import { GridLayout } from '../GridLayout';
|
6
|
+
import { isNarrowWidth } from '../utils/responsive';
|
7
|
+
import { rootLayoutStyle } from './styles/DefaultLayout.styles';
|
8
|
+
import { VideoGalleryResponsiveHorizontalGallery } from './VideoGalleryResponsiveHorizontalGallery';
|
9
|
+
import { useFloatingLocalVideoLayout } from './videoGalleryUtils';
|
10
|
+
/**
|
11
|
+
* DefaultLayout displays remote participants, local video component, and screen sharing component in
|
12
|
+
* a grid and horizontal gallery.
|
13
|
+
*
|
14
|
+
* @private
|
15
|
+
*/
|
16
|
+
export const DefaultLayout = (props) => {
|
17
|
+
const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, parentWidth } = props;
|
18
|
+
const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
|
19
|
+
const floatingLocalVideoLayout = useFloatingLocalVideoLayout({
|
20
|
+
remoteParticipants,
|
21
|
+
dominantSpeakers,
|
22
|
+
maxRemoteVideoStreams,
|
23
|
+
isScreenShareActive: !!screenShareComponent
|
24
|
+
});
|
25
|
+
let activeVideoStreams = 0;
|
26
|
+
const gridTiles = floatingLocalVideoLayout.gridParticipants.map((p) => {
|
27
|
+
var _a, _b;
|
28
|
+
return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
|
29
|
+
? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
|
30
|
+
: (_b = p.videoStream) === null || _b === void 0 ? void 0 : _b.isAvailable);
|
31
|
+
});
|
32
|
+
const horizontalGalleryTiles = floatingLocalVideoLayout.horizontalGalleryParticipants.map((p) => {
|
33
|
+
var _a, _b;
|
34
|
+
return onRenderRemoteParticipant(p, maxRemoteVideoStreams && maxRemoteVideoStreams >= 0
|
35
|
+
? ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) && activeVideoStreams++ < maxRemoteVideoStreams
|
36
|
+
: (_b = p.videoStream) === null || _b === void 0 ? void 0 : _b.isAvailable);
|
37
|
+
});
|
38
|
+
if (localVideoComponent) {
|
39
|
+
gridTiles.push(localVideoComponent);
|
40
|
+
}
|
41
|
+
return (React.createElement(Stack, { horizontal: false, styles: rootLayoutStyle },
|
42
|
+
screenShareComponent ? (screenShareComponent) : (React.createElement(GridLayout, { key: "grid-layout", styles: styles === null || styles === void 0 ? void 0 : styles.gridLayout }, gridTiles)),
|
43
|
+
horizontalGalleryTiles.length > 0 && (React.createElement(VideoGalleryResponsiveHorizontalGallery, { isNarrow: isNarrow, horizontalGalleryElements: horizontalGalleryTiles, styles: styles === null || styles === void 0 ? void 0 : styles.horizontalGallery }))));
|
44
|
+
};
|
45
|
+
//# sourceMappingURL=DefaultLayout.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/DefaultLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,uCAAuC,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAiClE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAe,EAAE;IACtE,MAAM,EACJ,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,EACN,qBAAqB,EACrB,WAAW,EACZ,GAAG,KAAK,CAAC;IAEV,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAElE,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;QAC3D,kBAAkB;QAClB,gBAAgB;QAChB,qBAAqB;QACrB,mBAAmB,EAAE,CAAC,CAAC,oBAAoB;KAC5C,CAAC,CAAC;IAEH,IAAI,kBAAkB,GAAG,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;;QACpE,OAAO,yBAAyB,CAC9B,CAAC,EACD,qBAAqB,IAAI,qBAAqB,IAAI,CAAC;YACjD,CAAC,CAAC,CAAA,MAAA,CAAC,CAAC,WAAW,0CAAE,WAAW,KAAI,kBAAkB,EAAE,GAAG,qBAAqB;YAC5E,CAAC,CAAC,MAAA,CAAC,CAAC,WAAW,0CAAE,WAAW,CAC/B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,sBAAsB,GAAG,wBAAwB,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;;QAC9F,OAAO,yBAAyB,CAC9B,CAAC,EACD,qBAAqB,IAAI,qBAAqB,IAAI,CAAC;YACjD,CAAC,CAAC,CAAA,MAAA,CAAC,CAAC,WAAW,0CAAE,WAAW,KAAI,kBAAkB,EAAE,GAAG,qBAAqB;YAC5E,CAAC,CAAC,MAAA,CAAC,CAAC,WAAW,0CAAE,WAAW,CAC/B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,mBAAmB,EAAE;QACvB,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;KACrC;IAED,OAAO,CACL,oBAAC,KAAK,IAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe;QAC9C,oBAAoB,CAAC,CAAC,CAAC,CACtB,oBAAoB,CACrB,CAAC,CAAC,CAAC,CACF,oBAAC,UAAU,IAAC,GAAG,EAAC,aAAa,EAAC,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,IACrD,SAAS,CACC,CACd;QACA,sBAAsB,CAAC,MAAM,GAAG,CAAC,IAAI,CACpC,oBAAC,uCAAuC,IACtC,QAAQ,EAAE,QAAQ,EAClB,yBAAyB,EAAE,sBAAsB,EACjD,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB,GACjC,CACH,CACK,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Stack } from '@fluentui/react';\nimport React from 'react';\nimport { VideoGalleryRemoteParticipant } from '../../types';\nimport { GridLayout } from '../GridLayout';\nimport { isNarrowWidth } from '../utils/responsive';\nimport { VideoGalleryStyles } from '../VideoGallery';\nimport { rootLayoutStyle } from './styles/DefaultLayout.styles';\nimport { VideoGalleryResponsiveHorizontalGallery } from './VideoGalleryResponsiveHorizontalGallery';\nimport { useFloatingLocalVideoLayout } from './videoGalleryUtils';\n\n/**\n * Props for {@link DefaultLayout}.\n *\n * @private\n */\nexport interface DefaultLayoutProps {\n /**\n * Styles for the {@link DefaultLayout}\n */\n styles?: Omit<VideoGalleryStyles, 'root'>;\n /** List of remote video particpants */\n remoteParticipants?: VideoGalleryRemoteParticipant[];\n /** Callback to render each remote participant */\n onRenderRemoteParticipant: (participant: VideoGalleryRemoteParticipant, isVideoParticipant?: boolean) => JSX.Element;\n /** List of dominant speaker userIds in the order of their dominance. 0th index is the most dominant. */\n dominantSpeakers?: string[];\n /** Component that contains local video content */\n localVideoComponent?: JSX.Element;\n /** Component that contains screen share content */\n screenShareComponent?: JSX.Element;\n /**\n * Maximum number of participant remote video streams that is rendered.\n * @defaultValue 4\n */\n maxRemoteVideoStreams?: number;\n /**\n * Width of parent element\n */\n parentWidth?: number;\n}\n\n/**\n * DefaultLayout displays remote participants, local video component, and screen sharing component in\n * a grid and horizontal gallery.\n *\n * @private\n */\nexport const DefaultLayout = (props: DefaultLayoutProps): JSX.Element => {\n const {\n remoteParticipants = [],\n dominantSpeakers,\n localVideoComponent,\n screenShareComponent,\n onRenderRemoteParticipant,\n styles,\n maxRemoteVideoStreams,\n parentWidth\n } = props;\n\n const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;\n\n const floatingLocalVideoLayout = useFloatingLocalVideoLayout({\n remoteParticipants,\n dominantSpeakers,\n maxRemoteVideoStreams,\n isScreenShareActive: !!screenShareComponent\n });\n\n let activeVideoStreams = 0;\n\n const gridTiles = floatingLocalVideoLayout.gridParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable && activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n const horizontalGalleryTiles = floatingLocalVideoLayout.horizontalGalleryParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable && activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n if (localVideoComponent) {\n gridTiles.push(localVideoComponent);\n }\n\n return (\n <Stack horizontal={false} styles={rootLayoutStyle}>\n {screenShareComponent ? (\n screenShareComponent\n ) : (\n <GridLayout key=\"grid-layout\" styles={styles?.gridLayout}>\n {gridTiles}\n </GridLayout>\n )}\n {horizontalGalleryTiles.length > 0 && (\n <VideoGalleryResponsiveHorizontalGallery\n isNarrow={isNarrow}\n horizontalGalleryElements={horizontalGalleryTiles}\n styles={styles?.horizontalGallery}\n />\n )}\n </Stack>\n );\n};\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { HorizontalGalleryStyles } from '../HorizontalGallery';
|
3
|
+
/**
|
4
|
+
* A ResponsiveHorizontalGallery styled for the @link{VideoGallery}
|
5
|
+
*/
|
6
|
+
export declare const VideoGalleryResponsiveHorizontalGallery: (props: {
|
7
|
+
shouldFloatLocalVideo?: boolean;
|
8
|
+
isNarrow?: boolean;
|
9
|
+
horizontalGalleryElements?: JSX.Element[];
|
10
|
+
styles?: HorizontalGalleryStyles;
|
11
|
+
}) => JSX.Element;
|
12
|
+
//# sourceMappingURL=VideoGalleryResponsiveHorizontalGallery.d.ts.map
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
import { concatStyleSets, Stack } from '@fluentui/react';
|
4
|
+
import React, { useMemo } from 'react';
|
5
|
+
import { ResponsiveHorizontalGallery } from '../ResponsiveHorizontalGallery';
|
6
|
+
import { HORIZONTAL_GALLERY_BUTTON_WIDTH, HORIZONTAL_GALLERY_GAP } from '../styles/HorizontalGallery.styles';
|
7
|
+
import { horizontalGalleryContainerStyle, horizontalGalleryStyle, LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM, SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM } from './styles/VideoGalleryResponsiveHorizontalGallery.styles';
|
8
|
+
/**
|
9
|
+
* A ResponsiveHorizontalGallery styled for the @link{VideoGallery}
|
10
|
+
*/
|
11
|
+
export const VideoGalleryResponsiveHorizontalGallery = (props) => {
|
12
|
+
const { shouldFloatLocalVideo = false, isNarrow = false, horizontalGalleryElements, styles } = props;
|
13
|
+
const containerStyles = useMemo(() => horizontalGalleryContainerStyle(shouldFloatLocalVideo, isNarrow), [shouldFloatLocalVideo, isNarrow]);
|
14
|
+
const galleryStyles = useMemo(() => concatStyleSets(horizontalGalleryStyle(isNarrow), styles), [isNarrow, styles]);
|
15
|
+
return (React.createElement(Stack, { styles: { root: { paddingTop: '0.5rem' } } },
|
16
|
+
React.createElement(ResponsiveHorizontalGallery, { key: "responsive-horizontal-gallery", containerStyles: containerStyles, horizontalGalleryStyles: galleryStyles, childWidthRem: isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width : LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width, buttonWidthRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapWidthRem: HORIZONTAL_GALLERY_GAP }, horizontalGalleryElements)));
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=VideoGalleryResponsiveHorizontalGallery.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"VideoGalleryResponsiveHorizontalGallery.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/VideoGalleryResponsiveHorizontalGallery.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,EAAE,OAAO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from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { HorizontalGalleryStyles } from '../HorizontalGallery';\nimport { ResponsiveHorizontalGallery } from '../ResponsiveHorizontalGallery';\nimport { HORIZONTAL_GALLERY_BUTTON_WIDTH, HORIZONTAL_GALLERY_GAP } from '../styles/HorizontalGallery.styles';\nimport {\n horizontalGalleryContainerStyle,\n horizontalGalleryStyle,\n LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM,\n SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM\n} from './styles/VideoGalleryResponsiveHorizontalGallery.styles';\n\n/**\n * A ResponsiveHorizontalGallery styled for the @link{VideoGallery}\n */\nexport const VideoGalleryResponsiveHorizontalGallery = (props: {\n shouldFloatLocalVideo?: boolean;\n isNarrow?: boolean;\n horizontalGalleryElements?: JSX.Element[];\n styles?: HorizontalGalleryStyles;\n}): JSX.Element => {\n const { shouldFloatLocalVideo = false, isNarrow = false, horizontalGalleryElements, styles } = props;\n\n const containerStyles = useMemo(\n () => horizontalGalleryContainerStyle(shouldFloatLocalVideo, isNarrow),\n [shouldFloatLocalVideo, isNarrow]\n );\n const galleryStyles = useMemo(() => concatStyleSets(horizontalGalleryStyle(isNarrow), styles), [isNarrow, styles]);\n\n return (\n <Stack styles={{ root: { paddingTop: '0.5rem' } }}>\n <ResponsiveHorizontalGallery\n key=\"responsive-horizontal-gallery\"\n containerStyles={containerStyles}\n horizontalGalleryStyles={galleryStyles}\n childWidthRem={\n isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width : LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width\n }\n buttonWidthRem={HORIZONTAL_GALLERY_BUTTON_WIDTH}\n gapWidthRem={HORIZONTAL_GALLERY_GAP}\n >\n {horizontalGalleryElements}\n </ResponsiveHorizontalGallery>\n </Stack>\n );\n};\n"]}
|
package/dist/dist-esm/react-components/src/components/VideoGallery/styles/DefaultLayout.styles.js
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
/**
|
4
|
+
* @private
|
5
|
+
*/
|
6
|
+
export const rootLayoutStyle = {
|
7
|
+
root: { position: 'relative', height: '100%', width: '100%', padding: '0.5rem' }
|
8
|
+
};
|
9
|
+
//# sourceMappingURL=DefaultLayout.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DefaultLayout.styles.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/styles/DefaultLayout.styles.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAiB;IAC3C,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;CACjF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStackStyles } from '@fluentui/react';\n\n/**\n * @private\n */\nexport const rootLayoutStyle: IStackStyles = {\n root: { position: 'relative', height: '100%', width: '100%', padding: '0.5rem' }\n};\n"]}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { IStyle } from '@fluentui/react';
|
2
|
+
import { HorizontalGalleryStyles } from '../../HorizontalGallery';
|
3
|
+
/**
|
4
|
+
* Small floating modal width and height in rem for small screen
|
5
|
+
*/
|
6
|
+
export declare const SMALL_FLOATING_MODAL_SIZE_PX: {
|
7
|
+
width: number;
|
8
|
+
height: number;
|
9
|
+
};
|
10
|
+
/**
|
11
|
+
* Large floating modal width and height in rem for large screen
|
12
|
+
*/
|
13
|
+
export declare const LARGE_FLOATING_MODAL_SIZE_PX: {
|
14
|
+
width: number;
|
15
|
+
height: number;
|
16
|
+
};
|
17
|
+
/**
|
18
|
+
* @private
|
19
|
+
*/
|
20
|
+
export declare const horizontalGalleryContainerStyle: (shouldFloatLocalVideo: boolean, isNarrow: boolean) => IStyle;
|
21
|
+
/**
|
22
|
+
* @private
|
23
|
+
*/
|
24
|
+
export declare const horizontalGalleryStyle: (isNarrow: boolean) => HorizontalGalleryStyles;
|
25
|
+
/**
|
26
|
+
* Small horizontal gallery tile size in rem
|
27
|
+
* @private
|
28
|
+
*/
|
29
|
+
export declare const SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM: {
|
30
|
+
height: number;
|
31
|
+
width: number;
|
32
|
+
};
|
33
|
+
/**
|
34
|
+
* Large horizontal gallery tile size in rem
|
35
|
+
* @private
|
36
|
+
*/
|
37
|
+
export declare const LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM: {
|
38
|
+
height: number;
|
39
|
+
width: number;
|
40
|
+
};
|
41
|
+
/**
|
42
|
+
* @private
|
43
|
+
*/
|
44
|
+
export declare const SMALL_HORIZONTAL_GALLERY_TILE_STYLE: {
|
45
|
+
minHeight: string;
|
46
|
+
minWidth: string;
|
47
|
+
maxHeight: string;
|
48
|
+
maxWidth: string;
|
49
|
+
};
|
50
|
+
/**
|
51
|
+
* @private
|
52
|
+
*/
|
53
|
+
export declare const LARGE_HORIZONTAL_GALLERY_TILE_STYLE: {
|
54
|
+
minHeight: string;
|
55
|
+
minWidth: string;
|
56
|
+
maxHeight: string;
|
57
|
+
maxWidth: string;
|
58
|
+
};
|
59
|
+
//# sourceMappingURL=VideoGalleryResponsiveHorizontalGallery.styles.d.ts.map
|
@@ -0,0 +1,64 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
import { _pxToRem } from "../../../../../acs-ui-common/src";
|
4
|
+
/**
|
5
|
+
* Small floating modal width and height in rem for small screen
|
6
|
+
*/
|
7
|
+
export const SMALL_FLOATING_MODAL_SIZE_PX = { width: 64, height: 88 };
|
8
|
+
/**
|
9
|
+
* Large floating modal width and height in rem for large screen
|
10
|
+
*/
|
11
|
+
export const LARGE_FLOATING_MODAL_SIZE_PX = { width: 160, height: 120 };
|
12
|
+
/**
|
13
|
+
* @private
|
14
|
+
*/
|
15
|
+
export const horizontalGalleryContainerStyle = (shouldFloatLocalVideo, isNarrow) => {
|
16
|
+
return {
|
17
|
+
minHeight: isNarrow
|
18
|
+
? `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`
|
19
|
+
: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
|
20
|
+
width: shouldFloatLocalVideo
|
21
|
+
? isNarrow
|
22
|
+
? `calc(100% - ${_pxToRem(SMALL_FLOATING_MODAL_SIZE_PX.width)})`
|
23
|
+
: `calc(100% - ${_pxToRem(LARGE_FLOATING_MODAL_SIZE_PX.width)})`
|
24
|
+
: '100%',
|
25
|
+
paddingRight: '0.5rem'
|
26
|
+
};
|
27
|
+
};
|
28
|
+
/**
|
29
|
+
* @private
|
30
|
+
*/
|
31
|
+
export const horizontalGalleryStyle = (isNarrow) => {
|
32
|
+
return {
|
33
|
+
children: isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_STYLE : LARGE_HORIZONTAL_GALLERY_TILE_STYLE
|
34
|
+
};
|
35
|
+
};
|
36
|
+
/**
|
37
|
+
* Small horizontal gallery tile size in rem
|
38
|
+
* @private
|
39
|
+
*/
|
40
|
+
export const SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 5.5, width: 5.5 };
|
41
|
+
/**
|
42
|
+
* Large horizontal gallery tile size in rem
|
43
|
+
* @private
|
44
|
+
*/
|
45
|
+
export const LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 7.5, width: 10 };
|
46
|
+
/**
|
47
|
+
* @private
|
48
|
+
*/
|
49
|
+
export const SMALL_HORIZONTAL_GALLERY_TILE_STYLE = {
|
50
|
+
minHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
|
51
|
+
minWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`,
|
52
|
+
maxHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
|
53
|
+
maxWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`
|
54
|
+
};
|
55
|
+
/**
|
56
|
+
* @private
|
57
|
+
*/
|
58
|
+
export const LARGE_HORIZONTAL_GALLERY_TILE_STYLE = {
|
59
|
+
minHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
|
60
|
+
minWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`,
|
61
|
+
maxHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
|
62
|
+
maxWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`
|
63
|
+
};
|
64
|
+
//# sourceMappingURL=VideoGalleryResponsiveHorizontalGallery.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"VideoGalleryResponsiveHorizontalGallery.styles.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveHorizontalGallery.styles.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,QAAQ,EAAE,yCAAgC;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,qBAA8B,EAAE,QAAiB,EAAU,EAAE;IAC3G,OAAO;QACL,SAAS,EAAE,QAAQ;YACjB,CAAC,CAAC,GAAG,sCAAsC,CAAC,MAAM,KAAK;YACvD,CAAC,CAAC,GAAG,sCAAsC,CAAC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;CAC/D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle } from '@fluentui/react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport { HorizontalGalleryStyles } from '../../HorizontalGallery';\n\n/**\n * Small floating modal width and height in rem for small screen\n */\nexport const SMALL_FLOATING_MODAL_SIZE_PX = { width: 64, height: 88 };\n\n/**\n * Large floating modal width and height in rem for large screen\n */\nexport const LARGE_FLOATING_MODAL_SIZE_PX = { width: 160, height: 120 };\n\n/**\n * @private\n */\nexport const horizontalGalleryContainerStyle = (shouldFloatLocalVideo: boolean, isNarrow: boolean): IStyle => {\n return {\n minHeight: isNarrow\n ? `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`\n : `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,\n width: shouldFloatLocalVideo\n ? isNarrow\n ? `calc(100% - ${_pxToRem(SMALL_FLOATING_MODAL_SIZE_PX.width)})`\n : `calc(100% - ${_pxToRem(LARGE_FLOATING_MODAL_SIZE_PX.width)})`\n : '100%',\n paddingRight: '0.5rem'\n };\n};\n\n/**\n * @private\n */\nexport const horizontalGalleryStyle = (isNarrow: boolean): HorizontalGalleryStyles => {\n return {\n children: isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_STYLE : LARGE_HORIZONTAL_GALLERY_TILE_STYLE\n };\n};\n\n/**\n * Small horizontal gallery tile size in rem\n * @private\n */\nexport const SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 5.5, width: 5.5 };\n/**\n * Large horizontal gallery tile size in rem\n * @private\n */\nexport const LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 7.5, width: 10 };\n\n/**\n * @private\n */\nexport const SMALL_HORIZONTAL_GALLERY_TILE_STYLE = {\n minHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,\n minWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`,\n maxHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,\n maxWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`\n};\n/**\n * @private\n */\nexport const LARGE_HORIZONTAL_GALLERY_TILE_STYLE = {\n minHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,\n minWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`,\n maxHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,\n maxWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`\n};\n\"../../../../../acs-ui-common/src\""]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { VideoGalleryParticipant, VideoGalleryRemoteParticipant } from '../../types';
|
2
|
+
declare type LayoutResult = {
|
3
|
+
gridParticipants: VideoGalleryParticipant[];
|
4
|
+
horizontalGalleryParticipants: VideoGalleryParticipant[];
|
5
|
+
};
|
6
|
+
/**
|
7
|
+
* @private
|
8
|
+
*/
|
9
|
+
export declare const useFloatingLocalVideoLayout: (props: {
|
10
|
+
remoteParticipants: VideoGalleryRemoteParticipant[];
|
11
|
+
dominantSpeakers?: string[];
|
12
|
+
maxRemoteVideoStreams?: number;
|
13
|
+
maxAudioDominantSpeakers?: number;
|
14
|
+
isScreenShareActive?: boolean;
|
15
|
+
}) => LayoutResult;
|
16
|
+
export {};
|
17
|
+
//# sourceMappingURL=videoGalleryUtils.d.ts.map
|
@@ -0,0 +1,68 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
import { useCallback, useRef } from 'react';
|
4
|
+
import { smartDominantSpeakerParticipants } from '../../gallery';
|
5
|
+
const DEFAULT_MAX_REMOTE_VIDEOSTREAMS = 4;
|
6
|
+
const DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS = 6;
|
7
|
+
/**
|
8
|
+
* @private
|
9
|
+
*/
|
10
|
+
export const useFloatingLocalVideoLayout = (props) => {
|
11
|
+
var _a, _b;
|
12
|
+
const visibleVideoParticipants = useRef([]);
|
13
|
+
const visibleAudioParticipants = useRef([]);
|
14
|
+
const { remoteParticipants, dominantSpeakers, maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEOSTREAMS, maxAudioDominantSpeakers = DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS, isScreenShareActive = false } = props;
|
15
|
+
visibleVideoParticipants.current = smartDominantSpeakerParticipants({
|
16
|
+
participants: (_a = remoteParticipants === null || remoteParticipants === void 0 ? void 0 : remoteParticipants.filter((p) => { var _a; return (_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable; })) !== null && _a !== void 0 ? _a : [],
|
17
|
+
dominantSpeakers,
|
18
|
+
lastVisibleParticipants: visibleVideoParticipants.current,
|
19
|
+
maxDominantSpeakers: maxRemoteVideoStreams
|
20
|
+
}).slice(0, maxRemoteVideoStreams);
|
21
|
+
const visibleVideoParticipantsSet = new Set(visibleVideoParticipants.current.map((p) => p.userId));
|
22
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
23
|
+
const callingParticipants = remoteParticipants.filter((p) => p.state === ('Connecting' || 'Ringing'));
|
24
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
25
|
+
const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));
|
26
|
+
visibleAudioParticipants.current = smartDominantSpeakerParticipants({
|
27
|
+
participants: (_b = remoteParticipants === null || remoteParticipants === void 0 ? void 0 : remoteParticipants.filter((p) => !visibleVideoParticipantsSet.has(p.userId) &&
|
28
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ !callingParticipantsSet.has(p.userId))) !== null && _b !== void 0 ? _b : [],
|
29
|
+
dominantSpeakers,
|
30
|
+
lastVisibleParticipants: visibleAudioParticipants.current,
|
31
|
+
maxDominantSpeakers: maxAudioDominantSpeakers
|
32
|
+
});
|
33
|
+
const getGridParticipants = useCallback(() => {
|
34
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
35
|
+
return visibleVideoParticipants.current.length > 0
|
36
|
+
? visibleVideoParticipants.current
|
37
|
+
: visibleAudioParticipants.current.concat(callingParticipants);
|
38
|
+
return visibleVideoParticipants.current.length > 0
|
39
|
+
? visibleVideoParticipants.current
|
40
|
+
: visibleAudioParticipants.current;
|
41
|
+
}, [
|
42
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants
|
43
|
+
]);
|
44
|
+
const gridParticipants = getGridParticipants();
|
45
|
+
const getHorizontalGalleryRemoteParticipants = useCallback(() => {
|
46
|
+
if (isScreenShareActive) {
|
47
|
+
// If screen sharing is active, assign video and audio participants as horizontal gallery participants
|
48
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
49
|
+
return visibleVideoParticipants.current.concat(visibleAudioParticipants.current.concat(callingParticipants));
|
50
|
+
return visibleVideoParticipants.current.concat(visibleAudioParticipants.current);
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
// If screen sharing is not active, then assign all video tiles as grid tiles.
|
54
|
+
// If there are no video tiles, then assign audio tiles as grid tiles.
|
55
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
56
|
+
return visibleVideoParticipants.current.length > 0
|
57
|
+
? visibleAudioParticipants.current.concat(callingParticipants)
|
58
|
+
: [];
|
59
|
+
return visibleVideoParticipants.current.length > 0 ? visibleAudioParticipants.current : [];
|
60
|
+
}
|
61
|
+
}, [
|
62
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,
|
63
|
+
isScreenShareActive
|
64
|
+
]);
|
65
|
+
const horizontalGalleryParticipants = getHorizontalGalleryRemoteParticipants();
|
66
|
+
return { gridParticipants, horizontalGalleryParticipants };
|
67
|
+
};
|
68
|
+
//# sourceMappingURL=videoGalleryUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"videoGalleryUtils.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/videoGalleryUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAQjE,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAE1C,MAAM,mCAAmC,GAAG,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAM3C,EAAgB,EAAE;;IACjB,MAAM,wBAAwB,GAAG,MAAM,CAAkC,EAAE,CAAC,CAAC;IAC7E,MAAM,wBAAwB,GAAG,MAAM,CAAkC,EAAE,CAAC,CAAC;IAE7E,MAAM,EACJ,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GAAG,+BAA+B,EACvD,wBAAwB,GAAG,mCAAmC,EAC9D,mBAAmB,GAAG,KAAK,EAC5B,GAAG,KAAK,CAAC;IAEV,wBAAwB,CAAC,OAAO,GAAG,gCAAgC,CAAC;QAClE,YAAY,EAAE,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,MAAA,CAAC,CAAC,WAAW,0CAAE,WAAW,CAAA,EAAA,CAAC,mCAAI,EAAE;QACjF,gBAAgB;QAChB,uBAAuB,EAAE,wBAAwB,CAAC,OAAO;QACzD,mBAAmB,EAAE,qBAAqB;KAC3C,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAEnC,MAAM,2BAA2B,GAAG,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wB,CAAC,OAAO;YAClC,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC;IACvC,CAAC,EAAE;QACD,6CAA6C,CAAC,mDAAmD,CAAC,mBAAmB;KACtH,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAE/C,MAAM,sCAAsC,GAAG,WAAW,CAAC,GAAoC,EAAE;QAC/F,IAAI,mBAAmB,EAAE;YACvB,sGAAsG;YACtG,6CAA6C,CAAC,mDAAmD;YACjG,OAAO,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;YAC7G,OAAO,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;SAClF;aAAM;YACL,8EAA8E;YAC9E,sEAAsE;YACtE,6CAA6C,CAAC,mDAAmD;YACjG,OAAO,wBAAwB,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;gBAChD,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC;gBAC9D,CAAC,CAAC,EAAE,CAAC;YACP,OAAO,wBAAwB,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5F;IACH,CAAC,EAAE;QACD,6CAA6C,CAAC,mDAAmD,CAAC,mBAAmB;QACrH,mBAAmB;KACpB,CAAC,CAAC;IAEH,MAAM,6BAA6B,GAAG,sCAAsC,EAAE,CAAC;IAE/E,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,CAAC;AAC7D,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { useCallback, useRef } from 'react';\nimport { smartDominantSpeakerParticipants } from '../../gallery';\nimport { VideoGalleryParticipant, VideoGalleryRemoteParticipant } from '../../types';\n\ntype LayoutResult = {\n gridParticipants: VideoGalleryParticipant[];\n horizontalGalleryParticipants: VideoGalleryParticipant[];\n};\n\nconst DEFAULT_MAX_REMOTE_VIDEOSTREAMS = 4;\n\nconst DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS = 6;\n\n/**\n * @private\n */\nexport const useFloatingLocalVideoLayout = (props: {\n remoteParticipants: VideoGalleryRemoteParticipant[];\n dominantSpeakers?: string[];\n maxRemoteVideoStreams?: number;\n maxAudioDominantSpeakers?: number;\n isScreenShareActive?: boolean;\n}): LayoutResult => {\n const visibleVideoParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n const visibleAudioParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n\n const {\n remoteParticipants,\n dominantSpeakers,\n maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEOSTREAMS,\n maxAudioDominantSpeakers = DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS,\n isScreenShareActive = false\n } = props;\n\n visibleVideoParticipants.current = smartDominantSpeakerParticipants({\n participants: remoteParticipants?.filter((p) => p.videoStream?.isAvailable) ?? [],\n dominantSpeakers,\n lastVisibleParticipants: visibleVideoParticipants.current,\n maxDominantSpeakers: maxRemoteVideoStreams\n }).slice(0, maxRemoteVideoStreams);\n\n const visibleVideoParticipantsSet = new Set(visibleVideoParticipants.current.map((p) => p.userId));\n\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n const callingParticipants = remoteParticipants.filter((p) => p.state === ('Connecting' || 'Ringing'));\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));\n\n visibleAudioParticipants.current = smartDominantSpeakerParticipants({\n participants:\n remoteParticipants?.filter(\n (p) =>\n !visibleVideoParticipantsSet.has(p.userId) &&\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ !callingParticipantsSet.has(\n p.userId\n )\n ) ?? [],\n dominantSpeakers,\n lastVisibleParticipants: visibleAudioParticipants.current,\n maxDominantSpeakers: maxAudioDominantSpeakers\n });\n\n const getGridParticipants = useCallback((): VideoGalleryRemoteParticipant[] => {\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return visibleVideoParticipants.current.length > 0\n ? visibleVideoParticipants.current\n : visibleAudioParticipants.current.concat(callingParticipants);\n return visibleVideoParticipants.current.length > 0\n ? visibleVideoParticipants.current\n : visibleAudioParticipants.current;\n }, [\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants\n ]);\n\n const gridParticipants = getGridParticipants();\n\n const getHorizontalGalleryRemoteParticipants = useCallback((): VideoGalleryRemoteParticipant[] => {\n if (isScreenShareActive) {\n // If screen sharing is active, assign video and audio participants as horizontal gallery participants\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return visibleVideoParticipants.current.concat(visibleAudioParticipants.current.concat(callingParticipants));\n return visibleVideoParticipants.current.concat(visibleAudioParticipants.current);\n } else {\n // If screen sharing is not active, then assign all video tiles as grid tiles.\n // If there are no video tiles, then assign audio tiles as grid tiles.\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return visibleVideoParticipants.current.length > 0\n ? visibleAudioParticipants.current.concat(callingParticipants)\n : [];\n return visibleVideoParticipants.current.length > 0 ? visibleAudioParticipants.current : [];\n }\n }, [\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,\n isScreenShareActive\n ]);\n\n const horizontalGalleryParticipants = getHorizontalGalleryRemoteParticipants();\n\n return { gridParticipants, horizontalGalleryParticipants };\n};\n"]}
|
@@ -8,9 +8,7 @@ import { useLocale } from '../localization';
|
|
8
8
|
import { useTheme } from '../theming';
|
9
9
|
import { GridLayout } from './GridLayout';
|
10
10
|
import { _RemoteVideoTile } from './RemoteVideoTile';
|
11
|
-
import {
|
12
|
-
import { HORIZONTAL_GALLERY_BUTTON_WIDTH, HORIZONTAL_GALLERY_GAP } from './styles/HorizontalGallery.styles';
|
13
|
-
import { LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM, SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM, floatingLocalVideoModalStyle, floatingLocalVideoTileStyle, horizontalGalleryContainerStyle, horizontalGalleryStyle, layerHostStyle, localVideoTileContainerStyle, videoGalleryContainerStyle, videoGalleryOuterDivStyle, localVideoTileOuterPaddingPX, SMALL_FLOATING_MODAL_SIZE_PX, LARGE_FLOATING_MODAL_SIZE_PX } from './styles/VideoGallery.styles';
|
11
|
+
import { floatingLocalVideoModalStyle, floatingLocalVideoTileStyle, layerHostStyle, localVideoTileContainerStyle, videoGalleryContainerStyle, videoGalleryOuterDivStyle, localVideoTileOuterPaddingPX, SMALL_FLOATING_MODAL_SIZE_PX, LARGE_FLOATING_MODAL_SIZE_PX } from './styles/VideoGallery.styles';
|
14
12
|
import { isNarrowWidth, _useContainerHeight, _useContainerWidth } from './utils/responsive';
|
15
13
|
import { LocalScreenShare } from './VideoGallery/LocalScreenShare';
|
16
14
|
import { RemoteScreenShare } from './VideoGallery/RemoteScreenShare';
|
@@ -20,6 +18,8 @@ import { _ModalClone } from './ModalClone/ModalClone';
|
|
20
18
|
import { _LocalVideoTile } from './LocalVideoTile';
|
21
19
|
/* @conditional-compile-remove(rooms) */
|
22
20
|
import { _usePermissions } from '../permissions';
|
21
|
+
import { DefaultLayout } from './VideoGallery/DefaultLayout';
|
22
|
+
import { VideoGalleryResponsiveHorizontalGallery } from './VideoGallery/VideoGalleryResponsiveHorizontalGallery';
|
23
23
|
/**
|
24
24
|
* @private
|
25
25
|
* Currently the Calling JS SDK supports up to 4 remote video streams
|
@@ -189,20 +189,28 @@ export const VideoGallery = (props) => {
|
|
189
189
|
const remoteScreenShareComponent = screenShareParticipant && (React.createElement(RemoteScreenShare, Object.assign({}, screenShareParticipant, { renderElement: (_d = screenShareParticipant.screenShareStream) === null || _d === void 0 ? void 0 : _d.renderElement, onCreateRemoteStreamView: onCreateRemoteStreamView, onDisposeRemoteStreamView: onDisposeRemoteStreamView, isReceiving: (_e = screenShareParticipant.screenShareStream) === null || _e === void 0 ? void 0 : _e.isReceiving })));
|
190
190
|
const horizontalGalleryPresent = horizontalGalleryTiles && horizontalGalleryTiles.length > 0;
|
191
191
|
const layerHostId = useId('layerhost');
|
192
|
+
if (layout === 'floatingLocalVideo') {
|
193
|
+
return (React.createElement("div", { "data-ui-id": ids.videoGallery, ref: containerRef, className: mergeStyles(videoGalleryOuterDivStyle, styles === null || styles === void 0 ? void 0 : styles.root) },
|
194
|
+
shouldFloatLocalVideo &&
|
195
|
+
!shouldFloatNonDraggableLocalVideo &&
|
196
|
+
localVideoTile &&
|
197
|
+
(horizontalGalleryPresent ? (React.createElement(Stack, { className: mergeStyles(localVideoTileContainerStyle(theme, isNarrow)) }, localVideoTile)) : (React.createElement(_ModalClone, { isOpen: true, isModeless: true, dragOptions: DRAG_OPTIONS, styles: floatingLocalVideoModalStyle(theme, isNarrow), layerProps: { hostId: layerHostId }, maxDragPosition: modalMaxDragPosition, minDragPosition: modalMinDragPosition }, localVideoTile))),
|
198
|
+
// When we use showCameraSwitcherInLocalPreview it disables dragging to allow keyboard navigation.
|
199
|
+
shouldFloatNonDraggableLocalVideo && localVideoTile && remoteParticipants.length > 0 && (React.createElement(Stack, { className: mergeStyles(localVideoTileWithControlsContainerStyle(theme, isNarrow), {
|
200
|
+
boxShadow: theme.effects.elevation8,
|
201
|
+
zIndex: LOCAL_VIDEO_TILE_ZINDEX
|
202
|
+
}) }, localVideoTile)),
|
203
|
+
React.createElement(Stack, { horizontal: false, styles: videoGalleryContainerStyle },
|
204
|
+
screenShareParticipant ? (remoteScreenShareComponent) : (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.isScreenSharingOn) ? (localScreenShareStreamComponent) : (React.createElement(GridLayout, { key: "grid-layout", styles: styles === null || styles === void 0 ? void 0 : styles.gridLayout }, gridTiles)),
|
205
|
+
horizontalGalleryPresent && (React.createElement(VideoGalleryResponsiveHorizontalGallery, { shouldFloatLocalVideo: true, isNarrow: isNarrow, horizontalGalleryElements: horizontalGalleryTiles, styles: styles === null || styles === void 0 ? void 0 : styles.horizontalGallery })),
|
206
|
+
React.createElement(LayerHost, { id: layerHostId, className: mergeStyles(layerHostStyle) }))));
|
207
|
+
}
|
208
|
+
const screenShareComponent = remoteScreenShareComponent
|
209
|
+
? remoteScreenShareComponent
|
210
|
+
: localParticipant.isScreenSharingOn
|
211
|
+
? localScreenShareStreamComponent
|
212
|
+
: undefined;
|
192
213
|
return (React.createElement("div", { "data-ui-id": ids.videoGallery, ref: containerRef, className: mergeStyles(videoGalleryOuterDivStyle, styles === null || styles === void 0 ? void 0 : styles.root) },
|
193
|
-
|
194
|
-
!shouldFloatNonDraggableLocalVideo &&
|
195
|
-
localVideoTile &&
|
196
|
-
(horizontalGalleryPresent ? (React.createElement(Stack, { className: mergeStyles(localVideoTileContainerStyle(theme, isNarrow)) }, localVideoTile)) : (React.createElement(_ModalClone, { isOpen: true, isModeless: true, dragOptions: DRAG_OPTIONS, styles: floatingLocalVideoModalStyle(theme, isNarrow), layerProps: { hostId: layerHostId }, maxDragPosition: modalMaxDragPosition, minDragPosition: modalMinDragPosition }, localVideoTile))),
|
197
|
-
// When we use showCameraSwitcherInLocalPreview it disables dragging to allow keyboard navigation.
|
198
|
-
shouldFloatNonDraggableLocalVideo && localVideoTile && remoteParticipants.length > 0 && (React.createElement(Stack, { className: mergeStyles(localVideoTileWithControlsContainerStyle(theme, isNarrow), {
|
199
|
-
boxShadow: theme.effects.elevation8,
|
200
|
-
zIndex: LOCAL_VIDEO_TILE_ZINDEX
|
201
|
-
}) }, localVideoTile)),
|
202
|
-
React.createElement(Stack, { horizontal: false, styles: videoGalleryContainerStyle },
|
203
|
-
screenShareParticipant ? (remoteScreenShareComponent) : (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.isScreenSharingOn) ? (localScreenShareStreamComponent) : (React.createElement(GridLayout, { key: "grid-layout", styles: styles === null || styles === void 0 ? void 0 : styles.gridLayout }, gridTiles)),
|
204
|
-
horizontalGalleryPresent && (React.createElement("div", { style: { paddingTop: '0.5rem' } },
|
205
|
-
React.createElement(ResponsiveHorizontalGallery, { key: "responsive-horizontal-gallery", containerStyles: horizontalGalleryContainerStyle(shouldFloatLocalVideo, isNarrow), horizontalGalleryStyles: concatStyleSets(horizontalGalleryStyle(isNarrow), styles === null || styles === void 0 ? void 0 : styles.horizontalGallery), childWidthRem: isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width : LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width, buttonWidthRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapWidthRem: HORIZONTAL_GALLERY_GAP }, horizontalGalleryTiles))),
|
206
|
-
React.createElement(LayerHost, { id: layerHostId, className: mergeStyles(layerHostStyle) }))));
|
214
|
+
React.createElement(DefaultLayout, { remoteParticipants: remoteParticipants, onRenderRemoteParticipant: onRenderRemoteVideoTile !== null && onRenderRemoteVideoTile !== void 0 ? onRenderRemoteVideoTile : defaultOnRenderVideoTile, localVideoComponent: localVideoTile, screenShareComponent: screenShareComponent, maxRemoteVideoStreams: maxRemoteVideoStreams, dominantSpeakers: dominantSpeakers, parentWidth: containerWidth, styles: styles })));
|
207
215
|
};
|
208
216
|
//# sourceMappingURL=VideoGallery.js.map
|