@azure/communication-react 1.14.0-alpha-202403160012 → 1.14.0-alpha-202403200012
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/communication-react.d.ts +14 -14
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BCdGFyar.js → RichTextSendBoxWrapper-DRoOTcxC.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BCdGFyar.js.map → RichTextSendBoxWrapper-DRoOTcxC.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-BfFCLrEO.js → index-CeYIHxFb.js} +695 -542
- package/dist/dist-cjs/communication-react/index-CeYIHxFb.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +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/calling-component-bindings/src/handlers/createCommonHandlers.js +2 -2
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.d.ts +2 -2
- package/dist/dist-esm/calling-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.d.ts +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +14 -12
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +2 -0
- package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedIterator.d.ts +2 -2
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/communication-react/src/mergedHooks.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js +12 -3
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +46 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +91 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{FluentChatMessageComponentWrapper.d.ts → MessageComponents/FluentChatMessageComponent.d.ts} +6 -7
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +122 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponent.d.ts → MyMessageComponents/ChatMyMessageComponent.d.ts} +9 -9
- package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponent.js → MyMessageComponents/ChatMyMessageComponent.js} +5 -5
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{ChatMessageComponentAsMessageBubble.d.ts → MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts} +10 -19
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +162 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.d.ts +12 -0
- package/dist/dist-esm/react-components/src/components/ChatMessage/{FluentChatMessageComponentWrapper.js → MyMessageComponents/FluentChatMyMessageComponent.js} +12 -54
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js +1 -4
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +3 -3
- package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +3 -5
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js +3 -5
- package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +3 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +98 -118
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +3 -7
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.js +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.d.ts +0 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ParticipantItem.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +29 -0
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +92 -0
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -0
- package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.d.ts +2 -3
- package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js +2 -2
- package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js +5 -3
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.js +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +5 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +5 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +2 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js +10 -12
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useAdaptedSelector.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +18 -18
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/usePropsFor.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +1 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.js +4 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +1 -5
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +4 -4
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +4 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useAdaptedSelector.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +5 -5
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +5 -5
- package/package.json +3 -5
- package/dist/dist-cjs/communication-react/index-BfFCLrEO.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +0 -218
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +0 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/FluentChatMessageComponentWrapper.js.map +0 -1
package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FloatingLocalVideoLayout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/FloatingLocalVideoLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,wCAAwC,EACxC,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,oCAAoC,CAAC;AAC5C,mDAAmD;AACnD,OAAO,EACL,8CAA8C,EAC9C,wCAAwC,EACzC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC7G,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CA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AM,CAAE,iBAAiB;QACzB,mDAAmD,CAAC,uBAAuB;QAC3E,kBAAkB;QAClB,mDAAmD,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,eAAe;QAC3E,WAAW;QACX,mBAAmB;KACpB,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,KAAK,IAAC,MAAM,EAAE,eAAe;QAC3B,0BAA0B;QAC3B,oBAAC,SAAS,IAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,cAAc,CAAC,GAAI;QACtE,oBAAC,KAAK;QACJ,mDAAmD;;YAAnD,mDAAmD;YACnD,UAAU,EAAE,uBAAuB,KAAK,eAAe,EACvD,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,qBAAqB;YAE5B,KAAK,CAAC,uBAAuB,KAAK,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,yCAAK;YAC3E,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;YACA,yBAAyB,CAAC,eAAe,EAAE,KAAK,CAAC,uBAAuB,CAAC,CACpE,CACF,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,OAA2B,EAC3B,eAAwE,EACpD,EAAE;IACtB,OAAO,eAAe,KAAK,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yCAAK,CAAC;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LayerHost, mergeStyles, Stack } from '@fluentui/react';\nimport { useId } from '@fluentui/react-hooks';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { useTheme } from '../../theming';\nimport { GridLayout } from '../GridLayout';\nimport { isNarrowWidth } from '../utils/responsive';\n/* @conditional-compile-remove(vertical-gallery) */\nimport { isShortHeight } from '../utils/responsive';\nimport { FloatingLocalVideo } from './FloatingLocalVideo';\nimport { LayoutProps } from './Layout';\nimport {\n LARGE_FLOATING_MODAL_SIZE_REM,\n localVideoTileContainerStyle,\n localVideoTileWithControlsContainerStyle,\n LOCAL_VIDEO_TILE_ZINDEX,\n SMALL_FLOATING_MODAL_SIZE_REM\n} from './styles/FloatingLocalVideo.styles';\n/* @conditional-compile-remove(vertical-gallery) */\nimport {\n SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM,\n VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n} from './styles/FloatingLocalVideo.styles';\nimport { innerLayoutStyle, layerHostStyle, rootLayoutStyle } from './styles/FloatingLocalVideoLayout.styles';\nimport { videoGalleryLayoutGap } from './styles/Layout.styles';\nimport { useOrganizedParticipants } from './utils/videoGalleryLayoutUtils';\nimport { OverflowGallery } from './OverflowGallery';\n/* @conditional-compile-remove(click-to-call) */\nimport { LocalVideoTileSize } from '../VideoGallery';\n\n/**\n * Props for {@link FloatingLocalVideoLayout}.\n *\n * @private\n */\nexport interface FloatingLocalVideoLayoutProps extends LayoutProps {\n /**\n * Whether to display the local video camera switcher button\n */\n showCameraSwitcherInLocalPreview?: boolean;\n /**\n * Height of parent element\n */\n parentHeight?: number;\n /* @conditional-compile-remove(click-to-call) */\n /**\n * Local video tile mode\n */\n localVideoTileSize?: LocalVideoTileSize;\n}\n\n/**\n * FloatingLocalVideoLayout displays remote participants and a screen sharing component in\n * a grid and overflow gallery while floating the local video\n *\n * @private\n */\nexport const FloatingLocalVideoLayout = (props: FloatingLocalVideoLayoutProps): JSX.Element => {\n const {\n remoteParticipants = [],\n dominantSpeakers,\n localVideoComponent,\n screenShareComponent,\n onRenderRemoteParticipant,\n styles,\n maxRemoteVideoStreams,\n showCameraSwitcherInLocalPreview,\n parentWidth,\n parentHeight,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition = 'horizontalBottom',\n pinnedParticipantUserIds = [],\n /* @conditional-compile-remove(click-to-call) */ localVideoTileSize,\n /* @conditional-compile-remove(spotlight) */ spotlightedParticipantUserIds\n } = props;\n\n const theme = useTheme();\n\n const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;\n\n /* @conditional-compile-remove(vertical-gallery) */\n const isShort = parentHeight ? isShortHeight(parentHeight) : false;\n\n // This is for tracking the number of children in the first page of overflow gallery.\n // This number will be used for the maxOverflowGalleryDominantSpeakers when organizing the remote participants.\n const childrenPerPage = useRef(4);\n const { gridParticipants, overflowGalleryParticipants } = useOrganizedParticipants({\n remoteParticipants,\n dominantSpeakers,\n maxRemoteVideoStreams,\n isScreenShareActive: !!screenShareComponent,\n maxOverflowGalleryDominantSpeakers: screenShareComponent\n ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)\n : childrenPerPage.current,\n pinnedParticipantUserIds,\n layout: 'floatingLocalVideo',\n /* @conditional-compile-remove(spotlight) */ spotlightedParticipantUserIds\n });\n\n let activeVideoStreams = 0;\n\n const gridTiles = 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 shouldFloatLocalVideo = remoteParticipants.length > 0;\n\n if (!shouldFloatLocalVideo && localVideoComponent) {\n gridTiles.push(localVideoComponent);\n }\n\n /**\n * instantiate indexes available to render with indexes available that would be on first page\n *\n * For some components which do not strictly follow the order of the array, we might\n * re-render the initial tiles -> dispose them -> create new tiles, we need to take care of\n * this case when those components are here\n */\n const [indexesToRender, setIndexesToRender] = useState<number[]>([]);\n\n const overflowGalleryTiles = overflowGalleryParticipants.map((p, i) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable &&\n indexesToRender &&\n indexesToRender.includes(i) &&\n activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n const layerHostId = useId('layerhost');\n\n const localVideoSizeRem = useMemo(() => {\n if (isNarrow || /*@conditional-compile-remove(click-to-call) */ localVideoTileSize === '9:16') {\n return SMALL_FLOATING_MODAL_SIZE_REM;\n }\n /* @conditional-compile-remove(vertical-gallery) */\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'verticalRight') {\n return isNarrow\n ? SMALL_FLOATING_MODAL_SIZE_REM\n : isShort\n ? SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n : VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM;\n }\n /*@conditional-compile-remove(click-to-call) */\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'horizontalBottom') {\n return localVideoTileSize === '16:9' || !isNarrow ? LARGE_FLOATING_MODAL_SIZE_REM : SMALL_FLOATING_MODAL_SIZE_REM;\n }\n return LARGE_FLOATING_MODAL_SIZE_REM;\n }, [\n overflowGalleryTiles.length,\n isNarrow,\n screenShareComponent,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n /* @conditional-compile-remove(click-to-call) */ localVideoTileSize\n ]);\n\n const wrappedLocalVideoComponent =\n (localVideoComponent && shouldFloatLocalVideo) || (screenShareComponent && localVideoComponent) ? (\n // When we use showCameraSwitcherInLocalPreview it disables dragging to allow keyboard navigation.\n showCameraSwitcherInLocalPreview ? (\n <Stack\n className={mergeStyles(localVideoTileWithControlsContainerStyle(theme, localVideoSizeRem), {\n boxShadow: theme.effects.elevation8,\n zIndex: LOCAL_VIDEO_TILE_ZINDEX\n })}\n >\n {localVideoComponent}\n </Stack>\n ) : overflowGalleryTiles.length > 0 || screenShareComponent ? (\n <Stack\n className={mergeStyles(\n localVideoTileContainerStyle(theme, localVideoSizeRem, !!screenShareComponent, overflowGalleryPosition)\n )}\n >\n {localVideoComponent}\n </Stack>\n ) : (\n <FloatingLocalVideo\n localVideoComponent={localVideoComponent}\n layerHostId={layerHostId}\n localVideoSizeRem={localVideoSizeRem}\n parentWidth={parentWidth}\n parentHeight={parentHeight}\n />\n )\n ) : undefined;\n\n const overflowGallery = useMemo(() => {\n if (overflowGalleryTiles.length === 0 && !screenShareComponent) {\n return null;\n }\n return (\n <OverflowGallery\n /* @conditional-compile-remove(vertical-gallery) */\n isShort={isShort}\n onFetchTilesToRender={setIndexesToRender}\n isNarrow={isNarrow}\n shouldFloatLocalVideo={!!localVideoComponent}\n overflowGalleryElements={overflowGalleryTiles}\n horizontalGalleryStyles={styles?.horizontalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n verticalGalleryStyles={styles?.verticalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n overflowGalleryPosition={overflowGalleryPosition}\n onChildrenPerPageChange={(n: number) => {\n childrenPerPage.current = n;\n }}\n parentWidth={parentWidth}\n />\n );\n }, [\n isNarrow,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n screenShareComponent,\n overflowGalleryTiles,\n styles?.horizontalGallery,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n setIndexesToRender,\n /* @conditional-compile-remove(vertical-gallery) */ styles?.verticalGallery,\n parentWidth,\n localVideoComponent\n ]);\n\n return (\n <Stack styles={rootLayoutStyle}>\n {wrappedLocalVideoComponent}\n <LayerHost id={layerHostId} className={mergeStyles(layerHostStyle)} />\n <Stack\n /* @conditional-compile-remove(vertical-gallery) */\n horizontal={overflowGalleryPosition === 'verticalRight'}\n styles={innerLayoutStyle}\n tokens={videoGalleryLayoutGap}\n >\n {props.overflowGalleryPosition === 'horizontalTop' ? overflowGallery : <></>}\n {screenShareComponent ? (\n screenShareComponent\n ) : (\n <GridLayout key=\"grid-layout\" styles={styles?.gridLayout}>\n {gridTiles}\n </GridLayout>\n )}\n {overflowGalleryTrampoline(overflowGallery, props.overflowGalleryPosition)}\n </Stack>\n </Stack>\n );\n};\n\nconst overflowGalleryTrampoline = (\n gallery: JSX.Element | null,\n galleryPosition?: 'horizontalBottom' | 'verticalRight' | 'horizontalTop'\n): JSX.Element | null => {\n return galleryPosition !== 'horizontalTop' ? gallery : <></>;\n return gallery;\n};\n"]}
|
1
|
+
{"version":3,"file":"FloatingLocalVideoLayout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/FloatingLocalVideoLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,wCAAwC,EACxC,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,oCAAoC,CAAC;AAC5C,mDAAmD;AACnD,OAAO,EACL,8CAA8C,EAC9C,wCAAwC,EACzC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC7G,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAi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MAAM,CAAE,eAAe;QAC3E,WAAW;QACX,mBAAmB;KACpB,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,KAAK,IAAC,MAAM,EAAE,eAAe;QAC3B,0BAA0B;QAC3B,oBAAC,SAAS,IAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,cAAc,CAAC,GAAI;QACtE,oBAAC,KAAK;QACJ,mDAAmD;;YAAnD,mDAAmD;YACnD,UAAU,EAAE,uBAAuB,KAAK,eAAe,EACvD,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,qBAAqB;YAE5B,KAAK,CAAC,uBAAuB,KAAK,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,yCAAK;YAC3E,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;YACA,yBAAyB,CAAC,eAAe,EAAE,KAAK,CAAC,uBAAuB,CAAC,CACpE,CACF,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,OAA2B,EAC3B,eAAwE,EACpD,EAAE;IACtB,OAAO,eAAe,KAAK,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yCAAK,CAAC;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LayerHost, mergeStyles, Stack } from '@fluentui/react';\nimport { useId } from '@fluentui/react-hooks';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { useTheme } from '../../theming';\nimport { GridLayout } from '../GridLayout';\nimport { isNarrowWidth } from '../utils/responsive';\n/* @conditional-compile-remove(vertical-gallery) */\nimport { isShortHeight } from '../utils/responsive';\nimport { FloatingLocalVideo } from './FloatingLocalVideo';\nimport { LayoutProps } from './Layout';\nimport {\n LARGE_FLOATING_MODAL_SIZE_REM,\n localVideoTileContainerStyle,\n localVideoTileWithControlsContainerStyle,\n LOCAL_VIDEO_TILE_ZINDEX,\n SMALL_FLOATING_MODAL_SIZE_REM\n} from './styles/FloatingLocalVideo.styles';\n/* @conditional-compile-remove(vertical-gallery) */\nimport {\n SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM,\n VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n} from './styles/FloatingLocalVideo.styles';\nimport { innerLayoutStyle, layerHostStyle, rootLayoutStyle } from './styles/FloatingLocalVideoLayout.styles';\nimport { videoGalleryLayoutGap } from './styles/Layout.styles';\nimport { useOrganizedParticipants } from './utils/videoGalleryLayoutUtils';\nimport { OverflowGallery } from './OverflowGallery';\nimport { LocalVideoTileSize } from '../VideoGallery';\n\n/**\n * Props for {@link FloatingLocalVideoLayout}.\n *\n * @private\n */\nexport interface FloatingLocalVideoLayoutProps extends LayoutProps {\n /**\n * Whether to display the local video camera switcher button\n */\n showCameraSwitcherInLocalPreview?: boolean;\n /**\n * Height of parent element\n */\n parentHeight?: number;\n /**\n * Local video tile mode\n */\n localVideoTileSize?: LocalVideoTileSize;\n}\n\n/**\n * FloatingLocalVideoLayout displays remote participants and a screen sharing component in\n * a grid and overflow gallery while floating the local video\n *\n * @private\n */\nexport const FloatingLocalVideoLayout = (props: FloatingLocalVideoLayoutProps): JSX.Element => {\n const {\n remoteParticipants = [],\n dominantSpeakers,\n localVideoComponent,\n screenShareComponent,\n onRenderRemoteParticipant,\n styles,\n maxRemoteVideoStreams,\n showCameraSwitcherInLocalPreview,\n parentWidth,\n parentHeight,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition = 'horizontalBottom',\n pinnedParticipantUserIds = [],\n localVideoTileSize,\n /* @conditional-compile-remove(spotlight) */ spotlightedParticipantUserIds\n } = props;\n\n const theme = useTheme();\n\n const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;\n\n /* @conditional-compile-remove(vertical-gallery) */\n const isShort = parentHeight ? isShortHeight(parentHeight) : false;\n\n // This is for tracking the number of children in the first page of overflow gallery.\n // This number will be used for the maxOverflowGalleryDominantSpeakers when organizing the remote participants.\n const childrenPerPage = useRef(4);\n const { gridParticipants, overflowGalleryParticipants } = useOrganizedParticipants({\n remoteParticipants,\n dominantSpeakers,\n maxRemoteVideoStreams,\n isScreenShareActive: !!screenShareComponent,\n maxOverflowGalleryDominantSpeakers: screenShareComponent\n ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)\n : childrenPerPage.current,\n pinnedParticipantUserIds,\n layout: 'floatingLocalVideo',\n /* @conditional-compile-remove(spotlight) */ spotlightedParticipantUserIds\n });\n\n let activeVideoStreams = 0;\n\n const gridTiles = 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 shouldFloatLocalVideo = remoteParticipants.length > 0;\n\n if (!shouldFloatLocalVideo && localVideoComponent) {\n gridTiles.push(localVideoComponent);\n }\n\n /**\n * instantiate indexes available to render with indexes available that would be on first page\n *\n * For some components which do not strictly follow the order of the array, we might\n * re-render the initial tiles -> dispose them -> create new tiles, we need to take care of\n * this case when those components are here\n */\n const [indexesToRender, setIndexesToRender] = useState<number[]>([]);\n\n const overflowGalleryTiles = overflowGalleryParticipants.map((p, i) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable &&\n indexesToRender &&\n indexesToRender.includes(i) &&\n activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n const layerHostId = useId('layerhost');\n\n const localVideoSizeRem = useMemo(() => {\n if (isNarrow || localVideoTileSize === '9:16') {\n return SMALL_FLOATING_MODAL_SIZE_REM;\n }\n /* @conditional-compile-remove(vertical-gallery) */\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'verticalRight') {\n return isNarrow\n ? SMALL_FLOATING_MODAL_SIZE_REM\n : isShort\n ? SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n : VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM;\n }\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'horizontalBottom') {\n return localVideoTileSize === '16:9' || !isNarrow ? LARGE_FLOATING_MODAL_SIZE_REM : SMALL_FLOATING_MODAL_SIZE_REM;\n }\n return LARGE_FLOATING_MODAL_SIZE_REM;\n }, [\n overflowGalleryTiles.length,\n isNarrow,\n screenShareComponent,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n localVideoTileSize\n ]);\n\n const wrappedLocalVideoComponent =\n (localVideoComponent && shouldFloatLocalVideo) || (screenShareComponent && localVideoComponent) ? (\n // When we use showCameraSwitcherInLocalPreview it disables dragging to allow keyboard navigation.\n showCameraSwitcherInLocalPreview ? (\n <Stack\n className={mergeStyles(localVideoTileWithControlsContainerStyle(theme, localVideoSizeRem), {\n boxShadow: theme.effects.elevation8,\n zIndex: LOCAL_VIDEO_TILE_ZINDEX\n })}\n >\n {localVideoComponent}\n </Stack>\n ) : overflowGalleryTiles.length > 0 || screenShareComponent ? (\n <Stack\n className={mergeStyles(\n localVideoTileContainerStyle(theme, localVideoSizeRem, !!screenShareComponent, overflowGalleryPosition)\n )}\n >\n {localVideoComponent}\n </Stack>\n ) : (\n <FloatingLocalVideo\n localVideoComponent={localVideoComponent}\n layerHostId={layerHostId}\n localVideoSizeRem={localVideoSizeRem}\n parentWidth={parentWidth}\n parentHeight={parentHeight}\n />\n )\n ) : undefined;\n\n const overflowGallery = useMemo(() => {\n if (overflowGalleryTiles.length === 0 && !screenShareComponent) {\n return null;\n }\n return (\n <OverflowGallery\n /* @conditional-compile-remove(vertical-gallery) */\n isShort={isShort}\n onFetchTilesToRender={setIndexesToRender}\n isNarrow={isNarrow}\n shouldFloatLocalVideo={!!localVideoComponent}\n overflowGalleryElements={overflowGalleryTiles}\n horizontalGalleryStyles={styles?.horizontalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n verticalGalleryStyles={styles?.verticalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n overflowGalleryPosition={overflowGalleryPosition}\n onChildrenPerPageChange={(n: number) => {\n childrenPerPage.current = n;\n }}\n parentWidth={parentWidth}\n />\n );\n }, [\n isNarrow,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n screenShareComponent,\n overflowGalleryTiles,\n styles?.horizontalGallery,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n setIndexesToRender,\n /* @conditional-compile-remove(vertical-gallery) */ styles?.verticalGallery,\n parentWidth,\n localVideoComponent\n ]);\n\n return (\n <Stack styles={rootLayoutStyle}>\n {wrappedLocalVideoComponent}\n <LayerHost id={layerHostId} className={mergeStyles(layerHostStyle)} />\n <Stack\n /* @conditional-compile-remove(vertical-gallery) */\n horizontal={overflowGalleryPosition === 'verticalRight'}\n styles={innerLayoutStyle}\n tokens={videoGalleryLayoutGap}\n >\n {props.overflowGalleryPosition === 'horizontalTop' ? overflowGallery : <></>}\n {screenShareComponent ? (\n screenShareComponent\n ) : (\n <GridLayout key=\"grid-layout\" styles={styles?.gridLayout}>\n {gridTiles}\n </GridLayout>\n )}\n {overflowGalleryTrampoline(overflowGallery, props.overflowGalleryPosition)}\n </Stack>\n </Stack>\n );\n};\n\nconst overflowGalleryTrampoline = (\n gallery: JSX.Element | null,\n galleryPosition?: 'horizontalBottom' | 'verticalRight' | 'horizontalTop'\n): JSX.Element | null => {\n return galleryPosition !== 'horizontalTop' ? gallery : <></>;\n return gallery;\n};\n"]}
|
@@ -23,8 +23,7 @@ import { useId } from '@fluentui/react-hooks';
|
|
23
23
|
export const SpeakerVideoLayout = (props) => {
|
24
24
|
const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, parentWidth,
|
25
25
|
/* @conditional-compile-remove(vertical-gallery) */ parentHeight,
|
26
|
-
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition = 'horizontalBottom', pinnedParticipantUserIds = [],
|
27
|
-
/* @conditional-compile-remove(click-to-call) */ localVideoTileSize } = props;
|
26
|
+
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition = 'horizontalBottom', pinnedParticipantUserIds = [], localVideoTileSize } = props;
|
28
27
|
const theme = useTheme();
|
29
28
|
const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
|
30
29
|
/* @conditional-compile-remove(vertical-gallery) */
|
@@ -73,7 +72,7 @@ export const SpeakerVideoLayout = (props) => {
|
|
73
72
|
});
|
74
73
|
const layerHostId = useId('layerhost');
|
75
74
|
const localVideoSizeRem = useMemo(() => {
|
76
|
-
if (isNarrow ||
|
75
|
+
if (isNarrow || localVideoTileSize === '9:16') {
|
77
76
|
return SMALL_FLOATING_MODAL_SIZE_REM;
|
78
77
|
}
|
79
78
|
/* @conditional-compile-remove(vertical-gallery) */
|
@@ -84,7 +83,6 @@ export const SpeakerVideoLayout = (props) => {
|
|
84
83
|
? SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM
|
85
84
|
: VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM;
|
86
85
|
}
|
87
|
-
/*@conditional-compile-remove(click-to-call) */
|
88
86
|
if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'horizontalBottom') {
|
89
87
|
return localVideoTileSize === '16:9' || !isNarrow ? LARGE_FLOATING_MODAL_SIZE_REM : SMALL_FLOATING_MODAL_SIZE_REM;
|
90
88
|
}
|
@@ -95,7 +93,7 @@ export const SpeakerVideoLayout = (props) => {
|
|
95
93
|
screenShareComponent,
|
96
94
|
/* @conditional-compile-remove(vertical-gallery) */ isShort,
|
97
95
|
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,
|
98
|
-
|
96
|
+
localVideoTileSize
|
99
97
|
]);
|
100
98
|
const wrappedLocalVideoComponent = localVideoComponent || (screenShareComponent && localVideoComponent) ? (React.createElement(Stack, { className: mergeStyles(localVideoTileContainerStyle(theme, localVideoSizeRem, !!screenShareComponent, overflowGalleryPosition)) }, localVideoComponent)) : undefined;
|
101
99
|
const overflowGallery = useMemo(() => {
|
package/dist/dist-esm/react-components/src/components/VideoGallery/SpeakerVideoLayout.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SpeakerVideoLayout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/SpeakerVideoLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAI1E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,oCAAoC,CAAC;AAC5C,mDAAmD;AACnD,OAAO,EACL,wCAAwC,EACxC,8CAA8C,EAC/C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CA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C,CAAC,yCAAK;YAC3E,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;YACA,yBAAyB,CAAC,eAAe,EAAE,KAAK,CAAC,uBAAuB,CAAC,CACpE,CACF,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,OAA2B,EAC3B,eAAwE,EACpD,EAAE;IACtB,OAAO,eAAe,KAAK,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yCAAK,CAAC;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LayerHost, Stack, mergeStyles, useTheme } from '@fluentui/react';\n/* @conditional-compile-remove(click-to-call) */\nimport { LocalVideoTileSize } from '../VideoGallery';\nimport { LayoutProps } from './Layout';\nimport { isNarrowWidth } from '../utils/responsive';\n/* @conditional-compile-remove(vertical-gallery) */\nimport { isShortHeight } from '../utils/responsive';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { OverflowGallery } from './OverflowGallery';\nimport {\n SMALL_FLOATING_MODAL_SIZE_REM,\n LARGE_FLOATING_MODAL_SIZE_REM,\n localVideoTileContainerStyle\n} from './styles/FloatingLocalVideo.styles';\n/* @conditional-compile-remove(vertical-gallery) */\nimport {\n VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM,\n SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n} from './styles/FloatingLocalVideo.styles';\nimport { useOrganizedParticipants } from './utils/videoGalleryLayoutUtils';\nimport { GridLayout } from '../GridLayout';\nimport { rootLayoutStyle } from './styles/FloatingLocalVideoLayout.styles';\nimport { layerHostStyle, innerLayoutStyle } from './styles/FloatingLocalVideoLayout.styles';\nimport { videoGalleryLayoutGap } from './styles/Layout.styles';\nimport { useId } from '@fluentui/react-hooks';\n\n/**\n * Props for {@link SpeakerVideoLayout}.\n *\n * @private\n */\nexport interface SpeakerVideoLayoutProps extends LayoutProps {\n /**\n * Whether to display the local video camera switcher button\n */\n showCameraSwitcherInLocalPreview?: boolean;\n /**\n * Height of parent element\n */\n parentHeight?: number;\n /* @conditional-compile-remove(click-to-call) */\n /**\n * Local video tile mode\n */\n localVideoTileSize?: LocalVideoTileSize;\n}\n\n/**\n * Layout for the gallery mode to highlight the current dominant speaker\n *\n * @private\n */\nexport const SpeakerVideoLayout = (props: SpeakerVideoLayoutProps): JSX.Element => {\n const {\n remoteParticipants = [],\n dominantSpeakers,\n localVideoComponent,\n screenShareComponent,\n onRenderRemoteParticipant,\n styles,\n maxRemoteVideoStreams,\n parentWidth,\n /* @conditional-compile-remove(vertical-gallery) */ parentHeight,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition = 'horizontalBottom',\n pinnedParticipantUserIds = [],\n /* @conditional-compile-remove(click-to-call) */ localVideoTileSize\n } = props;\n\n const theme = useTheme();\n\n const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;\n\n /* @conditional-compile-remove(vertical-gallery) */\n const isShort = parentHeight ? isShortHeight(parentHeight) : false;\n\n // This is for tracking the number of children in the first page of overflow gallery.\n // This number will be used for the maxOverflowGalleryDominantSpeakers when organizing the remote participants.\n const childrenPerPage = useRef(4);\n const { gridParticipants, overflowGalleryParticipants } = useOrganizedParticipants({\n remoteParticipants,\n dominantSpeakers,\n maxRemoteVideoStreams,\n isScreenShareActive: !!screenShareComponent,\n maxOverflowGalleryDominantSpeakers: screenShareComponent\n ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)\n : childrenPerPage.current,\n pinnedParticipantUserIds,\n layout: 'speaker'\n });\n\n let activeVideoStreams = 0;\n\n const gridTiles = 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 shouldFloatLocalVideo = remoteParticipants.length > 0;\n\n if (!shouldFloatLocalVideo && localVideoComponent) {\n gridTiles.push(localVideoComponent);\n }\n\n /**\n * instantiate indexes available to render with indexes available that would be on first page\n *\n * For some components which do not strictly follow the order of the array, we might\n * re-render the initial tiles -> dispose them -> create new tiles, we need to take care of\n * this case when those components are here\n */\n const [indexesToRender, setIndexesToRender] = useState<number[]>([]);\n\n const overflowGalleryTiles = overflowGalleryParticipants.map((p, i) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable &&\n indexesToRender &&\n indexesToRender.includes(i) &&\n activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n const layerHostId = useId('layerhost');\n\n const localVideoSizeRem = useMemo(() => {\n if (isNarrow || /*@conditional-compile-remove(click-to-call) */ localVideoTileSize === '9:16') {\n return SMALL_FLOATING_MODAL_SIZE_REM;\n }\n /* @conditional-compile-remove(vertical-gallery) */\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'verticalRight') {\n return isNarrow\n ? SMALL_FLOATING_MODAL_SIZE_REM\n : isShort\n ? SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n : VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM;\n }\n /*@conditional-compile-remove(click-to-call) */\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'horizontalBottom') {\n return localVideoTileSize === '16:9' || !isNarrow ? LARGE_FLOATING_MODAL_SIZE_REM : SMALL_FLOATING_MODAL_SIZE_REM;\n }\n return LARGE_FLOATING_MODAL_SIZE_REM;\n }, [\n overflowGalleryTiles.length,\n isNarrow,\n screenShareComponent,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n /* @conditional-compile-remove(click-to-call) */ localVideoTileSize\n ]);\n\n const wrappedLocalVideoComponent =\n localVideoComponent || (screenShareComponent && localVideoComponent) ? (\n <Stack\n className={mergeStyles(\n localVideoTileContainerStyle(theme, localVideoSizeRem, !!screenShareComponent, overflowGalleryPosition)\n )}\n >\n {localVideoComponent}\n </Stack>\n ) : undefined;\n\n const overflowGallery = useMemo(() => {\n if (overflowGalleryTiles.length === 0 && !screenShareComponent) {\n return null;\n }\n return (\n <OverflowGallery\n /* @conditional-compile-remove(vertical-gallery) */\n isShort={isShort}\n onFetchTilesToRender={setIndexesToRender}\n isNarrow={isNarrow}\n shouldFloatLocalVideo={!!localVideoComponent}\n overflowGalleryElements={overflowGalleryTiles}\n horizontalGalleryStyles={styles?.horizontalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n verticalGalleryStyles={styles?.verticalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n overflowGalleryPosition={overflowGalleryPosition}\n onChildrenPerPageChange={(n: number) => {\n childrenPerPage.current = n;\n }}\n parentWidth={parentWidth}\n />\n );\n }, [\n isNarrow,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n screenShareComponent,\n overflowGalleryTiles,\n styles?.horizontalGallery,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n setIndexesToRender,\n /* @conditional-compile-remove(vertical-gallery) */ styles?.verticalGallery,\n parentWidth,\n localVideoComponent\n ]);\n\n return (\n <Stack styles={rootLayoutStyle}>\n {wrappedLocalVideoComponent}\n <LayerHost id={layerHostId} className={mergeStyles(layerHostStyle)} />\n <Stack\n /* @conditional-compile-remove(vertical-gallery) */\n horizontal={overflowGalleryPosition === 'verticalRight'}\n styles={innerLayoutStyle}\n tokens={videoGalleryLayoutGap}\n >\n {props.overflowGalleryPosition === 'horizontalTop' ? overflowGallery : <></>}\n {screenShareComponent ? (\n screenShareComponent\n ) : (\n <GridLayout key=\"grid-layout\" styles={styles?.gridLayout}>\n {gridTiles}\n </GridLayout>\n )}\n {overflowGalleryTrampoline(overflowGallery, props.overflowGalleryPosition)}\n </Stack>\n </Stack>\n );\n};\n\nconst overflowGalleryTrampoline = (\n gallery: JSX.Element | null,\n galleryPosition?: 'horizontalBottom' | 'verticalRight' | 'horizontalTop'\n): JSX.Element | null => {\n return galleryPosition !== 'horizontalTop' ? gallery : <></>;\n return gallery;\n};\n"]}
|
1
|
+
{"version":3,"file":"SpeakerVideoLayout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/SpeakerVideoLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG1E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,oCAAoC,CAAC;AAC5C,mDAAmD;AACnD,OAAO,EACL,wCAAwC,EACxC,8CAA8C,EAC/C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,C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,CAAE,UAAU,IACrD,SAAS,CACC,CACd;YACA,yBAAyB,CAAC,eAAe,EAAE,KAAK,CAAC,uBAAuB,CAAC,CACpE,CACF,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,OAA2B,EAC3B,eAAwE,EACpD,EAAE;IACtB,OAAO,eAAe,KAAK,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yCAAK,CAAC;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LayerHost, Stack, mergeStyles, useTheme } from '@fluentui/react';\nimport { LocalVideoTileSize } from '../VideoGallery';\nimport { LayoutProps } from './Layout';\nimport { isNarrowWidth } from '../utils/responsive';\n/* @conditional-compile-remove(vertical-gallery) */\nimport { isShortHeight } from '../utils/responsive';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { OverflowGallery } from './OverflowGallery';\nimport {\n SMALL_FLOATING_MODAL_SIZE_REM,\n LARGE_FLOATING_MODAL_SIZE_REM,\n localVideoTileContainerStyle\n} from './styles/FloatingLocalVideo.styles';\n/* @conditional-compile-remove(vertical-gallery) */\nimport {\n VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM,\n SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n} from './styles/FloatingLocalVideo.styles';\nimport { useOrganizedParticipants } from './utils/videoGalleryLayoutUtils';\nimport { GridLayout } from '../GridLayout';\nimport { rootLayoutStyle } from './styles/FloatingLocalVideoLayout.styles';\nimport { layerHostStyle, innerLayoutStyle } from './styles/FloatingLocalVideoLayout.styles';\nimport { videoGalleryLayoutGap } from './styles/Layout.styles';\nimport { useId } from '@fluentui/react-hooks';\n\n/**\n * Props for {@link SpeakerVideoLayout}.\n *\n * @private\n */\nexport interface SpeakerVideoLayoutProps extends LayoutProps {\n /**\n * Whether to display the local video camera switcher button\n */\n showCameraSwitcherInLocalPreview?: boolean;\n /**\n * Height of parent element\n */\n parentHeight?: number;\n /**\n * Local video tile mode\n */\n localVideoTileSize?: LocalVideoTileSize;\n}\n\n/**\n * Layout for the gallery mode to highlight the current dominant speaker\n *\n * @private\n */\nexport const SpeakerVideoLayout = (props: SpeakerVideoLayoutProps): JSX.Element => {\n const {\n remoteParticipants = [],\n dominantSpeakers,\n localVideoComponent,\n screenShareComponent,\n onRenderRemoteParticipant,\n styles,\n maxRemoteVideoStreams,\n parentWidth,\n /* @conditional-compile-remove(vertical-gallery) */ parentHeight,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition = 'horizontalBottom',\n pinnedParticipantUserIds = [],\n localVideoTileSize\n } = props;\n\n const theme = useTheme();\n\n const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;\n\n /* @conditional-compile-remove(vertical-gallery) */\n const isShort = parentHeight ? isShortHeight(parentHeight) : false;\n\n // This is for tracking the number of children in the first page of overflow gallery.\n // This number will be used for the maxOverflowGalleryDominantSpeakers when organizing the remote participants.\n const childrenPerPage = useRef(4);\n const { gridParticipants, overflowGalleryParticipants } = useOrganizedParticipants({\n remoteParticipants,\n dominantSpeakers,\n maxRemoteVideoStreams,\n isScreenShareActive: !!screenShareComponent,\n maxOverflowGalleryDominantSpeakers: screenShareComponent\n ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)\n : childrenPerPage.current,\n pinnedParticipantUserIds,\n layout: 'speaker'\n });\n\n let activeVideoStreams = 0;\n\n const gridTiles = 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 shouldFloatLocalVideo = remoteParticipants.length > 0;\n\n if (!shouldFloatLocalVideo && localVideoComponent) {\n gridTiles.push(localVideoComponent);\n }\n\n /**\n * instantiate indexes available to render with indexes available that would be on first page\n *\n * For some components which do not strictly follow the order of the array, we might\n * re-render the initial tiles -> dispose them -> create new tiles, we need to take care of\n * this case when those components are here\n */\n const [indexesToRender, setIndexesToRender] = useState<number[]>([]);\n\n const overflowGalleryTiles = overflowGalleryParticipants.map((p, i) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable &&\n indexesToRender &&\n indexesToRender.includes(i) &&\n activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n const layerHostId = useId('layerhost');\n\n const localVideoSizeRem = useMemo(() => {\n if (isNarrow || localVideoTileSize === '9:16') {\n return SMALL_FLOATING_MODAL_SIZE_REM;\n }\n /* @conditional-compile-remove(vertical-gallery) */\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'verticalRight') {\n return isNarrow\n ? SMALL_FLOATING_MODAL_SIZE_REM\n : isShort\n ? SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM\n : VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM;\n }\n if ((overflowGalleryTiles.length > 0 || screenShareComponent) && overflowGalleryPosition === 'horizontalBottom') {\n return localVideoTileSize === '16:9' || !isNarrow ? LARGE_FLOATING_MODAL_SIZE_REM : SMALL_FLOATING_MODAL_SIZE_REM;\n }\n return LARGE_FLOATING_MODAL_SIZE_REM;\n }, [\n overflowGalleryTiles.length,\n isNarrow,\n screenShareComponent,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n localVideoTileSize\n ]);\n\n const wrappedLocalVideoComponent =\n localVideoComponent || (screenShareComponent && localVideoComponent) ? (\n <Stack\n className={mergeStyles(\n localVideoTileContainerStyle(theme, localVideoSizeRem, !!screenShareComponent, overflowGalleryPosition)\n )}\n >\n {localVideoComponent}\n </Stack>\n ) : undefined;\n\n const overflowGallery = useMemo(() => {\n if (overflowGalleryTiles.length === 0 && !screenShareComponent) {\n return null;\n }\n return (\n <OverflowGallery\n /* @conditional-compile-remove(vertical-gallery) */\n isShort={isShort}\n onFetchTilesToRender={setIndexesToRender}\n isNarrow={isNarrow}\n shouldFloatLocalVideo={!!localVideoComponent}\n overflowGalleryElements={overflowGalleryTiles}\n horizontalGalleryStyles={styles?.horizontalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n verticalGalleryStyles={styles?.verticalGallery}\n /* @conditional-compile-remove(vertical-gallery) */\n overflowGalleryPosition={overflowGalleryPosition}\n onChildrenPerPageChange={(n: number) => {\n childrenPerPage.current = n;\n }}\n parentWidth={parentWidth}\n />\n );\n }, [\n isNarrow,\n /* @conditional-compile-remove(vertical-gallery) */ isShort,\n screenShareComponent,\n overflowGalleryTiles,\n styles?.horizontalGallery,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,\n setIndexesToRender,\n /* @conditional-compile-remove(vertical-gallery) */ styles?.verticalGallery,\n parentWidth,\n localVideoComponent\n ]);\n\n return (\n <Stack styles={rootLayoutStyle}>\n {wrappedLocalVideoComponent}\n <LayerHost id={layerHostId} className={mergeStyles(layerHostStyle)} />\n <Stack\n /* @conditional-compile-remove(vertical-gallery) */\n horizontal={overflowGalleryPosition === 'verticalRight'}\n styles={innerLayoutStyle}\n tokens={videoGalleryLayoutGap}\n >\n {props.overflowGalleryPosition === 'horizontalTop' ? overflowGallery : <></>}\n {screenShareComponent ? (\n screenShareComponent\n ) : (\n <GridLayout key=\"grid-layout\" styles={styles?.gridLayout}>\n {gridTiles}\n </GridLayout>\n )}\n {overflowGalleryTrampoline(overflowGallery, props.overflowGalleryPosition)}\n </Stack>\n </Stack>\n );\n};\n\nconst overflowGalleryTrampoline = (\n gallery: JSX.Element | null,\n galleryPosition?: 'horizontalBottom' | 'verticalRight' | 'horizontalTop'\n): JSX.Element | null => {\n return galleryPosition !== 'horizontalTop' ? gallery : <></>;\n return gallery;\n};\n"]}
|
@@ -15,6 +15,8 @@ export interface OrganizedParticipantsArgs {
|
|
15
15
|
pinnedParticipantUserIds?: string[];
|
16
16
|
layout?: VideoGalleryLayout;
|
17
17
|
spotlightedParticipantUserIds?: string[];
|
18
|
+
previousGridParticipants?: VideoGalleryRemoteParticipant[];
|
19
|
+
previousOverflowParticipants?: VideoGalleryRemoteParticipant[];
|
18
20
|
}
|
19
21
|
/**
|
20
22
|
* A result that defines grid participants and overflow gallery participants in the VideoGallery
|
@@ -28,7 +30,7 @@ export interface OrganizedParticipantsResult {
|
|
28
30
|
* Hook to determine which participants should be in grid and overflow gallery and their order respectively
|
29
31
|
* @private
|
30
32
|
*/
|
31
|
-
export declare const useOrganizedParticipants: (
|
33
|
+
export declare const useOrganizedParticipants: (props: OrganizedParticipantsArgs) => OrganizedParticipantsResult;
|
32
34
|
/**
|
33
35
|
* @private
|
34
36
|
*/
|
package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js
CHANGED
@@ -1,112 +1,65 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
import {
|
3
|
+
import { useRef } from 'react';
|
4
4
|
import { smartDominantSpeakerParticipants } from '../../../gallery';
|
5
5
|
const DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS = 6;
|
6
6
|
const DEFAULT_MAX_VIDEO_SREAMS = 4;
|
7
7
|
const MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY = 9;
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY;
|
15
|
-
}
|
16
|
-
else {
|
17
|
-
return maxRemoteVideoStreams;
|
18
|
-
}
|
19
|
-
return maxRemoteVideoStreams;
|
20
|
-
};
|
21
|
-
const maxRemoteVideoStreamsToUse = calculateMaxRemoteVideoStreams();
|
8
|
+
const getOrganizedParticipants = (props) => {
|
9
|
+
const { remoteParticipants = [], dominantSpeakers = [], maxRemoteVideoStreams = DEFAULT_MAX_VIDEO_SREAMS, maxOverflowGalleryDominantSpeakers = DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS, isScreenShareActive = false, layout, previousGridParticipants = [], previousOverflowParticipants = [] } = props;
|
10
|
+
const maxRemoteVideoStreamsToUse = maxRemoteVideoStreams > MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY
|
11
|
+
? MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY
|
12
|
+
: maxRemoteVideoStreams;
|
13
|
+
const remoteParticipantsOrdered = putVideoParticipantsFirst(remoteParticipants);
|
22
14
|
const videoParticipants = remoteParticipants.filter((p) => { var _a; return (_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable; });
|
23
|
-
const
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
: smartDominantSpeakerParticipants({
|
31
|
-
participants: participantsToSortTrampoline(),
|
32
|
-
dominantSpeakers,
|
33
|
-
lastVisibleParticipants: visibleGridParticipants.current,
|
34
|
-
maxDominantSpeakers: maxRemoteVideoStreamsToUse
|
35
|
-
}).slice(0, maxRemoteVideoStreamsToUse);
|
15
|
+
const participants = layout === 'floatingLocalVideo' && videoParticipants.length > 0 ? videoParticipants : remoteParticipantsOrdered;
|
16
|
+
let newGridParticipants = smartDominantSpeakerParticipants({
|
17
|
+
participants: participants,
|
18
|
+
dominantSpeakers,
|
19
|
+
currentParticipants: previousGridParticipants,
|
20
|
+
maxDominantSpeakers: maxRemoteVideoStreamsToUse
|
21
|
+
}).slice(0, maxRemoteVideoStreamsToUse);
|
36
22
|
const dominantSpeakerToGrid = layout === 'speaker'
|
37
23
|
? dominantSpeakers && dominantSpeakers[0]
|
38
|
-
?
|
39
|
-
: [
|
24
|
+
? newGridParticipants.filter((p) => p.userId === dominantSpeakers[0])
|
25
|
+
: [newGridParticipants[0]]
|
40
26
|
: [];
|
41
27
|
if (dominantSpeakerToGrid[0]) {
|
42
|
-
|
28
|
+
newGridParticipants = dominantSpeakerToGrid;
|
43
29
|
}
|
44
|
-
const
|
45
|
-
const remoteParticipantsOrdered = putVideoParticipantsFirst(remoteParticipants);
|
30
|
+
const gridParticipantSet = new Set(newGridParticipants.map((p) => p.userId));
|
46
31
|
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
47
32
|
const callingParticipants = remoteParticipantsOrdered.filter((p) => p.state === ('Connecting' || 'Ringing'));
|
48
33
|
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
49
34
|
const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));
|
50
|
-
|
51
|
-
participants: remoteParticipantsOrdered.filter((p) => !
|
35
|
+
const newOverflowGalleryParticipants = smartDominantSpeakerParticipants({
|
36
|
+
participants: remoteParticipantsOrdered.filter((p) => !gridParticipantSet.has(p.userId) &&
|
52
37
|
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ !callingParticipantsSet.has(p.userId)),
|
53
38
|
dominantSpeakers: dominantSpeakers,
|
54
|
-
|
39
|
+
currentParticipants: previousOverflowParticipants,
|
55
40
|
maxDominantSpeakers: maxOverflowGalleryDominantSpeakers
|
56
41
|
});
|
57
|
-
const
|
58
|
-
if (isScreenShareActive) {
|
59
|
-
return [];
|
60
|
-
}
|
61
|
-
// if we have no grid participants we need to cap the max number of overflowGallery participants in the grid
|
62
|
-
// we will use the max streams provided to the function to find the max participants that can go in the grid
|
63
|
-
// if there are less participants than max streams then we will use all participants including joining in the grid
|
64
|
-
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
65
|
-
return visibleGridParticipants.current.length > 0
|
66
|
-
? visibleGridParticipants.current
|
67
|
-
: visibleOverflowGalleryParticipants.current.length > maxRemoteVideoStreamsToUse
|
68
|
-
? visibleOverflowGalleryParticipants.current.slice(0, maxRemoteVideoStreamsToUse)
|
69
|
-
: visibleOverflowGalleryParticipants.current.slice(0, maxRemoteVideoStreamsToUse).concat(callingParticipants);
|
70
|
-
return visibleGridParticipants.current.length > 0
|
71
|
-
? visibleGridParticipants.current
|
72
|
-
: visibleOverflowGalleryParticipants.current.slice(0, maxRemoteVideoStreamsToUse);
|
73
|
-
}, [
|
74
|
-
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,
|
42
|
+
const gridParticipants = getGridParticipants({
|
75
43
|
isScreenShareActive,
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
83
|
-
return visibleGridParticipants.current.concat(visibleOverflowGalleryParticipants.current.concat(callingParticipants));
|
84
|
-
return visibleGridParticipants.current.concat(visibleOverflowGalleryParticipants.current);
|
85
|
-
}
|
86
|
-
else {
|
87
|
-
// If screen sharing is not active, then assign all video tiles as grid tiles.
|
88
|
-
// If there are no video tiles, then assign audio tiles as grid tiles.
|
89
|
-
// if there are more overflow tiles than max streams then find the tiles that don't fit in the grid and put them in overflow
|
90
|
-
// overflow should be empty if total participants including calling participants is less than max streams
|
91
|
-
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
92
|
-
return visibleGridParticipants.current.length > 0
|
93
|
-
? visibleOverflowGalleryParticipants.current.concat(callingParticipants)
|
94
|
-
: visibleOverflowGalleryParticipants.current.length > maxRemoteVideoStreamsToUse
|
95
|
-
? visibleOverflowGalleryParticipants.current.slice(maxRemoteVideoStreamsToUse).concat(callingParticipants)
|
96
|
-
: [];
|
97
|
-
return visibleGridParticipants.current.length > 0
|
98
|
-
? visibleOverflowGalleryParticipants.current
|
99
|
-
: visibleOverflowGalleryParticipants.current.slice(maxRemoteVideoStreamsToUse);
|
100
|
-
}
|
101
|
-
}, [
|
102
|
-
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,
|
44
|
+
gridParticipants: newGridParticipants,
|
45
|
+
overflowGalleryParticipants: newOverflowGalleryParticipants,
|
46
|
+
maxRemoteVideoStreams: maxRemoteVideoStreamsToUse,
|
47
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants
|
48
|
+
});
|
49
|
+
const overflowGalleryParticipants = getOverflowGalleryRemoteParticipants({
|
103
50
|
isScreenShareActive,
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
51
|
+
gridParticipants: newGridParticipants,
|
52
|
+
overflowGalleryParticipants: newOverflowGalleryParticipants,
|
53
|
+
maxRemoteVideoStreams: maxRemoteVideoStreamsToUse,
|
54
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants
|
55
|
+
});
|
56
|
+
return { gridParticipants, overflowGalleryParticipants };
|
108
57
|
};
|
109
|
-
|
58
|
+
/**
|
59
|
+
* Hook to determine which participants should be in grid and overflow gallery and their order respectively
|
60
|
+
* @private
|
61
|
+
*/
|
62
|
+
export const useOrganizedParticipants = (props) => {
|
110
63
|
var _a, _b;
|
111
64
|
// map remote participants by userId
|
112
65
|
const remoteParticipantMap = props.remoteParticipants.reduce((map, remoteParticipant) => {
|
@@ -114,35 +67,69 @@ const _useOrganizedParticipantsWithFocusedParticipants = (props) => {
|
|
114
67
|
return map;
|
115
68
|
}, {});
|
116
69
|
const spotlightedParticipantUserIds = (_a = props.spotlightedParticipantUserIds) !== null && _a !== void 0 ? _a : [];
|
117
|
-
|
118
|
-
//
|
119
|
-
|
120
|
-
|
121
|
-
];
|
70
|
+
const pinnedParticipantUserIds = (_b = props.pinnedParticipantUserIds) !== null && _b !== void 0 ? _b : [];
|
71
|
+
// declare set of focused participant user ids as spotlighted participants user ids followed by
|
72
|
+
// pinned participants user ids which is deduplicated while maintaining order
|
73
|
+
const focusedParticipantUserIdSet = new Set(spotlightedParticipantUserIds.concat(pinnedParticipantUserIds).filter((p) => remoteParticipantMap[p]));
|
122
74
|
// get focused participants from map of remote participants in the order of the user ids
|
123
|
-
const focusedParticipants = [];
|
124
|
-
|
125
|
-
|
126
|
-
if (pinnedParticipant) {
|
127
|
-
focusedParticipants.push(pinnedParticipant);
|
128
|
-
}
|
129
|
-
});
|
130
|
-
// get unfocused participants by filtering out set of focused participant user ids from all remote participants
|
131
|
-
const focusedParticipantUserIdSet = new Set(focusedParticipantUserIds);
|
75
|
+
const focusedParticipants = [...focusedParticipantUserIdSet].map((p) => remoteParticipantMap[p]);
|
76
|
+
const currentGridParticipants = useRef([]);
|
77
|
+
const currentOverflowGalleryParticipants = useRef([]);
|
132
78
|
const unfocusedParticipants = props.remoteParticipants.filter((p) => !focusedParticipantUserIdSet.has(p.userId));
|
133
79
|
const useOrganizedParticipantsProps = Object.assign(Object.assign({}, props), {
|
134
|
-
// if there are
|
135
|
-
remoteParticipants: unfocusedParticipants });
|
136
|
-
const useOrganizedParticipantsResult =
|
137
|
-
|
138
|
-
|
80
|
+
// if there are focused participants then leave no room in the grid by setting maxGridParticipants to 0
|
81
|
+
maxRemoteVideoStreams: focusedParticipants.length > 0 || props.isScreenShareActive ? 0 : props.maxRemoteVideoStreams, remoteParticipants: unfocusedParticipants, previousGridParticipants: currentGridParticipants.current, previousOverflowParticipants: currentOverflowGalleryParticipants.current });
|
82
|
+
const useOrganizedParticipantsResult = getOrganizedParticipants(useOrganizedParticipantsProps);
|
83
|
+
currentGridParticipants.current = useOrganizedParticipantsResult.gridParticipants;
|
84
|
+
currentOverflowGalleryParticipants.current = useOrganizedParticipantsResult.overflowGalleryParticipants;
|
85
|
+
return focusedParticipants.length > 0
|
86
|
+
? {
|
87
|
+
gridParticipants: props.isScreenShareActive ? [] : focusedParticipants,
|
88
|
+
overflowGalleryParticipants: props.isScreenShareActive
|
89
|
+
? focusedParticipants.concat(useOrganizedParticipantsResult.overflowGalleryParticipants)
|
90
|
+
: useOrganizedParticipantsResult.overflowGalleryParticipants
|
91
|
+
}
|
92
|
+
: useOrganizedParticipantsResult;
|
93
|
+
};
|
94
|
+
const getGridParticipants = (args) => {
|
95
|
+
if (args.isScreenShareActive) {
|
96
|
+
return [];
|
97
|
+
}
|
98
|
+
// if we have no grid participants we need to cap the max number of overflowGallery participants in the grid
|
99
|
+
// we will use the max streams provided to the function to find the max participants that can go in the grid
|
100
|
+
// if there are less participants than max streams then we will use all participants including joining in the grid
|
101
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
102
|
+
return args.gridParticipants.length > 0
|
103
|
+
? args.gridParticipants
|
104
|
+
: args.overflowGalleryParticipants.length > args.maxRemoteVideoStreams
|
105
|
+
? args.overflowGalleryParticipants.slice(0, args.maxRemoteVideoStreams)
|
106
|
+
: args.overflowGalleryParticipants.slice(0, args.maxRemoteVideoStreams).concat(args.callingParticipants);
|
107
|
+
return args.gridParticipants.length > 0
|
108
|
+
? args.gridParticipants
|
109
|
+
: args.overflowGalleryParticipants.slice(0, args.maxRemoteVideoStreams);
|
110
|
+
};
|
111
|
+
const getOverflowGalleryRemoteParticipants = (args) => {
|
112
|
+
if (args.isScreenShareActive) {
|
113
|
+
// If screen sharing is active, assign video and audio participants as overflow gallery participants
|
114
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
115
|
+
return args.gridParticipants.concat(args.overflowGalleryParticipants.concat(args.callingParticipants));
|
116
|
+
return args.gridParticipants.concat(args.overflowGalleryParticipants);
|
117
|
+
}
|
118
|
+
else {
|
119
|
+
// If screen sharing is not active, then assign all video tiles as grid tiles.
|
120
|
+
// If there are no video tiles, then assign audio tiles as grid tiles.
|
121
|
+
// if there are more overflow tiles than max streams then find the tiles that don't fit in the grid and put them in overflow
|
122
|
+
// overflow should be empty if total participants including calling participants is less than max streams
|
123
|
+
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
124
|
+
return args.gridParticipants.length > 0
|
125
|
+
? args.overflowGalleryParticipants.concat(args.callingParticipants)
|
126
|
+
: args.overflowGalleryParticipants.length > args.maxRemoteVideoStreams
|
127
|
+
? args.overflowGalleryParticipants.slice(args.maxRemoteVideoStreams).concat(args.callingParticipants)
|
128
|
+
: [];
|
129
|
+
return args.gridParticipants.length > 0
|
130
|
+
? args.overflowGalleryParticipants
|
131
|
+
: args.overflowGalleryParticipants.slice(args.maxRemoteVideoStreams);
|
139
132
|
}
|
140
|
-
return {
|
141
|
-
gridParticipants: props.isScreenShareActive ? [] : focusedParticipants,
|
142
|
-
overflowGalleryParticipants: props.isScreenShareActive
|
143
|
-
? focusedParticipants.concat(useOrganizedParticipantsResult.overflowGalleryParticipants)
|
144
|
-
: useOrganizedParticipantsResult.gridParticipants.concat(useOrganizedParticipantsResult.overflowGalleryParticipants)
|
145
|
-
};
|
146
133
|
};
|
147
134
|
const putVideoParticipantsFirst = (remoteParticipants) => {
|
148
135
|
const videoParticipants = [];
|
@@ -159,13 +146,6 @@ const putVideoParticipantsFirst = (remoteParticipants) => {
|
|
159
146
|
const remoteParticipantSortedByVideo = videoParticipants.concat(audioParticipants);
|
160
147
|
return remoteParticipantSortedByVideo;
|
161
148
|
};
|
162
|
-
/**
|
163
|
-
* Hook to determine which participants should be in grid and overflow gallery and their order respectively
|
164
|
-
* @private
|
165
|
-
*/
|
166
|
-
export const useOrganizedParticipants = (args) => {
|
167
|
-
return _useOrganizedParticipantsWithFocusedParticipants(args);
|
168
|
-
};
|
169
149
|
/* @conditional-compile-remove(reaction) */
|
170
150
|
/**
|
171
151
|
* @private
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"videoGalleryLayoutUtils.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,O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AC,CAAC;AAEF,2CAA2C;AAC3C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAE,iBAAoC,EAAsB,EAAE;;IACjH,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,MAAA,iBAAiB,CAAC,YAAY,0CAAE,GAAG,CAAC;QAC7C,KAAK,OAAO;YACV,OAAO,MAAA,iBAAiB,CAAC,aAAa,0CAAE,GAAG,CAAC;QAC9C,KAAK,OAAO;YACV,OAAO,MAAA,iBAAiB,CAAC,aAAa,0CAAE,GAAG,CAAC;QAC9C,KAAK,UAAU;YACb,OAAO,MAAA,iBAAiB,CAAC,gBAAgB,0CAAE,GAAG,CAAC;QACjD,KAAK,WAAW;YACd,OAAO,MAAA,iBAAiB,CAAC,iBAAiB,0CAAE,GAAG,CAAC;IACpD,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,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/* @conditional-compile-remove(reaction) */\nimport { ReactionResources } from '../../..';\nimport { VideoGalleryLayout } from '../../VideoGallery';\n\n/**\n * Arguments used to determine a {@link OrganizedParticipantsResult}\n * @private\n */\nexport interface OrganizedParticipantsArgs {\n remoteParticipants: VideoGalleryRemoteParticipant[];\n localParticipant?: VideoGalleryParticipant;\n dominantSpeakers?: string[];\n maxRemoteVideoStreams?: number;\n maxOverflowGalleryDominantSpeakers?: number;\n isScreenShareActive?: boolean;\n pinnedParticipantUserIds?: string[];\n layout?: VideoGalleryLayout;\n spotlightedParticipantUserIds?: string[];\n}\n\n/**\n * A result that defines grid participants and overflow gallery participants in the VideoGallery\n * @private\n */\nexport interface OrganizedParticipantsResult {\n gridParticipants: VideoGalleryParticipant[];\n overflowGalleryParticipants: VideoGalleryParticipant[];\n}\n\nconst DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS = 6;\nconst DEFAULT_MAX_VIDEO_SREAMS = 4;\nconst MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY = 9;\n\nconst _useOrganizedParticipants = (props: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n const visibleGridParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n const visibleOverflowGalleryParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n\n const {\n remoteParticipants = [],\n dominantSpeakers = [],\n maxRemoteVideoStreams = DEFAULT_MAX_VIDEO_SREAMS,\n maxOverflowGalleryDominantSpeakers = DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS,\n isScreenShareActive = false,\n pinnedParticipantUserIds = [],\n layout\n } = props;\n\n const calculateMaxRemoteVideoStreams = (): number => {\n if (maxRemoteVideoStreams > MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY) {\n return MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY;\n } else {\n return maxRemoteVideoStreams;\n }\n return maxRemoteVideoStreams;\n };\n\n const maxRemoteVideoStreamsToUse = calculateMaxRemoteVideoStreams();\n\n const videoParticipants = remoteParticipants.filter((p) => p.videoStream?.isAvailable);\n\n const participantsToSortTrampoline = (): VideoGalleryRemoteParticipant[] => {\n return layout !== 'floatingLocalVideo' ? putVideoParticipantsFirst(remoteParticipants) : videoParticipants;\n return videoParticipants;\n };\n\n visibleGridParticipants.current =\n pinnedParticipantUserIds.length > 0 || isScreenShareActive\n ? []\n : smartDominantSpeakerParticipants({\n participants: participantsToSortTrampoline(),\n dominantSpeakers,\n lastVisibleParticipants: visibleGridParticipants.current,\n maxDominantSpeakers: maxRemoteVideoStreamsToUse\n }).slice(0, maxRemoteVideoStreamsToUse);\n\n const dominantSpeakerToGrid =\n layout === 'speaker'\n ? dominantSpeakers && dominantSpeakers[0]\n ? visibleGridParticipants.current.filter((p) => p.userId === dominantSpeakers[0])\n : [visibleGridParticipants.current[0]]\n : [];\n if (dominantSpeakerToGrid[0]) {\n visibleGridParticipants.current = dominantSpeakerToGrid;\n }\n\n const visibleGridParticipantsSet = new Set(visibleGridParticipants.current.map((p) => p.userId));\n\n const remoteParticipantsOrdered = putVideoParticipantsFirst(remoteParticipants);\n\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n const callingParticipants = remoteParticipantsOrdered.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 visibleOverflowGalleryParticipants.current = smartDominantSpeakerParticipants({\n participants: remoteParticipantsOrdered.filter(\n (p) =>\n !visibleGridParticipantsSet.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: dominantSpeakers,\n lastVisibleParticipants: visibleOverflowGalleryParticipants.current,\n maxDominantSpeakers: maxOverflowGalleryDominantSpeakers\n });\n\n const getGridParticipants = useCallback((): VideoGalleryRemoteParticipant[] => {\n if (isScreenShareActive) {\n return [];\n }\n // if we have no grid participants we need to cap the max number of overflowGallery participants in the grid\n // we will use the max streams provided to the function to find the max participants that can go in the grid\n // if there are less participants than max streams then we will use all participants including joining in the grid\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return visibleGridParticipants.current.length > 0\n ? visibleGridParticipants.current\n : visibleOverflowGalleryParticipants.current.length > maxRemoteVideoStreamsToUse\n ? visibleOverflowGalleryParticipants.current.slice(0, maxRemoteVideoStreamsToUse)\n : visibleOverflowGalleryParticipants.current.slice(0, maxRemoteVideoStreamsToUse).concat(callingParticipants);\n return visibleGridParticipants.current.length > 0\n ? visibleGridParticipants.current\n : visibleOverflowGalleryParticipants.current.slice(0, maxRemoteVideoStreamsToUse);\n }, [\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,\n isScreenShareActive,\n maxRemoteVideoStreamsToUse\n ]);\n\n const gridParticipants = getGridParticipants();\n\n const getOverflowGalleryRemoteParticipants = useCallback((): (\n | VideoGalleryParticipant\n | VideoGalleryRemoteParticipant\n )[] => {\n if (isScreenShareActive) {\n // If screen sharing is active, assign video and audio participants as overflow gallery participants\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return visibleGridParticipants.current.concat(\n visibleOverflowGalleryParticipants.current.concat(callingParticipants)\n );\n return visibleGridParticipants.current.concat(visibleOverflowGalleryParticipants.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 // if there are more overflow tiles than max streams then find the tiles that don't fit in the grid and put them in overflow\n // overflow should be empty if total participants including calling participants is less than max streams\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return visibleGridParticipants.current.length > 0\n ? visibleOverflowGalleryParticipants.current.concat(callingParticipants)\n : visibleOverflowGalleryParticipants.current.length > maxRemoteVideoStreamsToUse\n ? visibleOverflowGalleryParticipants.current.slice(maxRemoteVideoStreamsToUse).concat(callingParticipants)\n : [];\n return visibleGridParticipants.current.length > 0\n ? visibleOverflowGalleryParticipants.current\n : visibleOverflowGalleryParticipants.current.slice(maxRemoteVideoStreamsToUse);\n }\n }, [\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,\n isScreenShareActive,\n maxRemoteVideoStreamsToUse\n ]);\n\n const overflowGalleryParticipants = getOverflowGalleryRemoteParticipants();\n\n return { gridParticipants, overflowGalleryParticipants: overflowGalleryParticipants };\n};\n\ninterface SortedRemoteParticipants {\n [key: string]: VideoGalleryRemoteParticipant;\n}\n\nconst _useOrganizedParticipantsWithFocusedParticipants = (\n props: OrganizedParticipantsArgs\n): OrganizedParticipantsResult => {\n // map remote participants by userId\n const remoteParticipantMap = props.remoteParticipants.reduce((map, remoteParticipant) => {\n map[remoteParticipant.userId] = remoteParticipant;\n return map;\n }, {} as SortedRemoteParticipants);\n\n const spotlightedParticipantUserIds = props.spotlightedParticipantUserIds ?? [];\n // declare focused participant user ids as spotlighted participants user ids followed by\n // pinned participants user ids\n const focusedParticipantUserIds = [\n ...new Set(spotlightedParticipantUserIds.concat(props.pinnedParticipantUserIds ?? []))\n ];\n // get focused participants from map of remote participants in the order of the user ids\n const focusedParticipants: VideoGalleryRemoteParticipant[] = [];\n focusedParticipantUserIds.forEach((id) => {\n const pinnedParticipant = remoteParticipantMap[id];\n if (pinnedParticipant) {\n focusedParticipants.push(pinnedParticipant);\n }\n });\n\n // get unfocused participants by filtering out set of focused participant user ids from all remote participants\n const focusedParticipantUserIdSet = new Set(focusedParticipantUserIds);\n const unfocusedParticipants = props.remoteParticipants.filter((p) => !focusedParticipantUserIdSet.has(p.userId));\n\n const useOrganizedParticipantsProps = {\n ...props,\n // if there are pinned participants then we should only consider unpinned participants\n remoteParticipants: unfocusedParticipants\n };\n\n const useOrganizedParticipantsResult = _useOrganizedParticipants(useOrganizedParticipantsProps);\n\n if (focusedParticipants.length === 0) {\n return useOrganizedParticipantsResult;\n }\n\n return {\n gridParticipants: props.isScreenShareActive ? [] : focusedParticipants,\n overflowGalleryParticipants: props.isScreenShareActive\n ? focusedParticipants.concat(useOrganizedParticipantsResult.overflowGalleryParticipants)\n : useOrganizedParticipantsResult.gridParticipants.concat(\n useOrganizedParticipantsResult.overflowGalleryParticipants\n )\n };\n};\n\nconst putVideoParticipantsFirst = (\n remoteParticipants: VideoGalleryRemoteParticipant[]\n): VideoGalleryRemoteParticipant[] => {\n const videoParticipants: VideoGalleryRemoteParticipant[] = [];\n const audioParticipants: VideoGalleryRemoteParticipant[] = [];\n remoteParticipants.forEach((p) => {\n if (p.videoStream?.isAvailable) {\n videoParticipants.push(p);\n } else {\n audioParticipants.push(p);\n }\n });\n const remoteParticipantSortedByVideo = videoParticipants.concat(audioParticipants);\n return remoteParticipantSortedByVideo;\n};\n\n/**\n * Hook to determine which participants should be in grid and overflow gallery and their order respectively\n * @private\n */\nexport const useOrganizedParticipants = (args: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n return _useOrganizedParticipantsWithFocusedParticipants(args);\n};\n\n/* @conditional-compile-remove(reaction) */\n/**\n * @private\n */\nexport const getEmojiResource = (reactionName: string, reactionResources: ReactionResources): string | undefined => {\n switch (reactionName) {\n case 'like':\n return reactionResources.likeReaction?.url;\n case 'heart':\n return reactionResources.heartReaction?.url;\n case 'laugh':\n return reactionResources.laughReaction?.url;\n case 'applause':\n return reactionResources.applauseReaction?.url;\n case 'surprised':\n return reactionResources.surprisedReaction?.url;\n }\n return '';\n};\n"]}
|
1
|
+
{"version":3,"file":"videoGalleryLayoutUtils.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAiCpE,MAAM,8CAA8C,GAAG,CAAC,CAAC;AACzD,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,uCAAuC,GAAG,CAAC,CAAC;AAElD,MAAM,wBAAwB,GAAG,CAAC,KAAgC,EAA+B,EAAE;IACjG,MAAM,EACJ,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,GAAG,EAAE,EACrB,qBAAqB,GAAG,wBAAwB,EAChD,kCAAkC,GAAG,8CAA8C,EACnF,mBAAmB,GAAG,KAAK,EAC3B,MAAM,EACN,wBAAwB,GAAG,EAAE,EAC7B,4BAA4B,GAAG,EAAE,EAClC,GAAG,KAAK,CAAC;IAEV,MAAM,0BAA0B,GAC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ent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { useRef } from 'react';\nimport { smartDominantSpeakerParticipants } from '../../../gallery';\nimport { VideoGalleryParticipant, VideoGalleryRemoteParticipant } from '../../../types';\n/* @conditional-compile-remove(reaction) */\nimport { ReactionResources } from '../../..';\nimport { VideoGalleryLayout } from '../../VideoGallery';\n\n/**\n * Arguments used to determine a {@link OrganizedParticipantsResult}\n * @private\n */\nexport interface OrganizedParticipantsArgs {\n remoteParticipants: VideoGalleryRemoteParticipant[];\n localParticipant?: VideoGalleryParticipant;\n dominantSpeakers?: string[];\n maxRemoteVideoStreams?: number;\n maxOverflowGalleryDominantSpeakers?: number;\n isScreenShareActive?: boolean;\n pinnedParticipantUserIds?: string[];\n layout?: VideoGalleryLayout;\n spotlightedParticipantUserIds?: string[];\n previousGridParticipants?: VideoGalleryRemoteParticipant[];\n previousOverflowParticipants?: VideoGalleryRemoteParticipant[];\n}\n\n/**\n * A result that defines grid participants and overflow gallery participants in the VideoGallery\n * @private\n */\nexport interface OrganizedParticipantsResult {\n gridParticipants: VideoGalleryParticipant[];\n overflowGalleryParticipants: VideoGalleryParticipant[];\n}\n\nconst DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS = 6;\nconst DEFAULT_MAX_VIDEO_SREAMS = 4;\nconst MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY = 9;\n\nconst getOrganizedParticipants = (props: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n const {\n remoteParticipants = [],\n dominantSpeakers = [],\n maxRemoteVideoStreams = DEFAULT_MAX_VIDEO_SREAMS,\n maxOverflowGalleryDominantSpeakers = DEFAULT_MAX_OVERFLOW_GALLERY_DOMINANT_SPEAKERS,\n isScreenShareActive = false,\n layout,\n previousGridParticipants = [],\n previousOverflowParticipants = []\n } = props;\n\n const maxRemoteVideoStreamsToUse =\n maxRemoteVideoStreams > MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY\n ? MAX_GRID_PARTICIPANTS_NOT_LARGE_GALLERY\n : maxRemoteVideoStreams;\n\n const remoteParticipantsOrdered = putVideoParticipantsFirst(remoteParticipants);\n const videoParticipants = remoteParticipants.filter((p) => p.videoStream?.isAvailable);\n const participants =\n layout === 'floatingLocalVideo' && videoParticipants.length > 0 ? videoParticipants : remoteParticipantsOrdered;\n\n let newGridParticipants = smartDominantSpeakerParticipants({\n participants: participants,\n dominantSpeakers,\n currentParticipants: previousGridParticipants,\n maxDominantSpeakers: maxRemoteVideoStreamsToUse\n }).slice(0, maxRemoteVideoStreamsToUse);\n\n const dominantSpeakerToGrid =\n layout === 'speaker'\n ? dominantSpeakers && dominantSpeakers[0]\n ? newGridParticipants.filter((p) => p.userId === dominantSpeakers[0])\n : [newGridParticipants[0]]\n : [];\n\n if (dominantSpeakerToGrid[0]) {\n newGridParticipants = dominantSpeakerToGrid;\n }\n\n const gridParticipantSet = new Set(newGridParticipants.map((p) => p.userId));\n\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n const callingParticipants = remoteParticipantsOrdered.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 const newOverflowGalleryParticipants = smartDominantSpeakerParticipants({\n participants: remoteParticipantsOrdered.filter(\n (p) =>\n !gridParticipantSet.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: dominantSpeakers,\n currentParticipants: previousOverflowParticipants,\n maxDominantSpeakers: maxOverflowGalleryDominantSpeakers\n });\n\n const gridParticipants = getGridParticipants({\n isScreenShareActive,\n gridParticipants: newGridParticipants,\n overflowGalleryParticipants: newOverflowGalleryParticipants,\n maxRemoteVideoStreams: maxRemoteVideoStreamsToUse,\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants\n });\n\n const overflowGalleryParticipants = getOverflowGalleryRemoteParticipants({\n isScreenShareActive,\n gridParticipants: newGridParticipants,\n overflowGalleryParticipants: newOverflowGalleryParticipants,\n maxRemoteVideoStreams: maxRemoteVideoStreamsToUse,\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants\n });\n\n return { gridParticipants, overflowGalleryParticipants };\n};\n\ninterface SortedRemoteParticipants {\n [key: string]: VideoGalleryRemoteParticipant;\n}\n\n/**\n * Hook to determine which participants should be in grid and overflow gallery and their order respectively\n * @private\n */\nexport const useOrganizedParticipants = (props: OrganizedParticipantsArgs): OrganizedParticipantsResult => {\n // map remote participants by userId\n const remoteParticipantMap = props.remoteParticipants.reduce((map, remoteParticipant) => {\n map[remoteParticipant.userId] = remoteParticipant;\n return map;\n }, {} as SortedRemoteParticipants);\n\n const spotlightedParticipantUserIds = props.spotlightedParticipantUserIds ?? [];\n const pinnedParticipantUserIds = props.pinnedParticipantUserIds ?? [];\n // declare set of focused participant user ids as spotlighted participants user ids followed by\n // pinned participants user ids which is deduplicated while maintaining order\n const focusedParticipantUserIdSet = new Set(\n spotlightedParticipantUserIds.concat(pinnedParticipantUserIds).filter((p) => remoteParticipantMap[p])\n );\n // get focused participants from map of remote participants in the order of the user ids\n const focusedParticipants: VideoGalleryRemoteParticipant[] = [...focusedParticipantUserIdSet].map(\n (p) => remoteParticipantMap[p]\n );\n\n const currentGridParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n const currentOverflowGalleryParticipants = useRef<VideoGalleryRemoteParticipant[]>([]);\n\n const unfocusedParticipants = props.remoteParticipants.filter((p) => !focusedParticipantUserIdSet.has(p.userId));\n\n const useOrganizedParticipantsProps: OrganizedParticipantsArgs = {\n ...props,\n // if there are focused participants then leave no room in the grid by setting maxGridParticipants to 0\n maxRemoteVideoStreams:\n focusedParticipants.length > 0 || props.isScreenShareActive ? 0 : props.maxRemoteVideoStreams,\n remoteParticipants: unfocusedParticipants,\n previousGridParticipants: currentGridParticipants.current,\n previousOverflowParticipants: currentOverflowGalleryParticipants.current\n };\n\n const useOrganizedParticipantsResult = getOrganizedParticipants(useOrganizedParticipantsProps);\n\n currentGridParticipants.current = useOrganizedParticipantsResult.gridParticipants;\n currentOverflowGalleryParticipants.current = useOrganizedParticipantsResult.overflowGalleryParticipants;\n\n return focusedParticipants.length > 0\n ? {\n gridParticipants: props.isScreenShareActive ? [] : focusedParticipants,\n overflowGalleryParticipants: props.isScreenShareActive\n ? focusedParticipants.concat(useOrganizedParticipantsResult.overflowGalleryParticipants)\n : useOrganizedParticipantsResult.overflowGalleryParticipants\n }\n : useOrganizedParticipantsResult;\n};\n\nconst getGridParticipants = (args: {\n isScreenShareActive: boolean;\n gridParticipants: VideoGalleryParticipant[];\n overflowGalleryParticipants: VideoGalleryParticipant[];\n maxRemoteVideoStreams: number;\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants: VideoGalleryParticipant[];\n}): VideoGalleryRemoteParticipant[] => {\n if (args.isScreenShareActive) {\n return [];\n }\n // if we have no grid participants we need to cap the max number of overflowGallery participants in the grid\n // we will use the max streams provided to the function to find the max participants that can go in the grid\n // if there are less participants than max streams then we will use all participants including joining in the grid\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return args.gridParticipants.length > 0\n ? args.gridParticipants\n : args.overflowGalleryParticipants.length > args.maxRemoteVideoStreams\n ? args.overflowGalleryParticipants.slice(0, args.maxRemoteVideoStreams)\n : args.overflowGalleryParticipants.slice(0, args.maxRemoteVideoStreams).concat(args.callingParticipants);\n return args.gridParticipants.length > 0\n ? args.gridParticipants\n : args.overflowGalleryParticipants.slice(0, args.maxRemoteVideoStreams);\n};\n\nconst getOverflowGalleryRemoteParticipants = (args: {\n isScreenShareActive: boolean;\n gridParticipants: VideoGalleryParticipant[];\n overflowGalleryParticipants: VideoGalleryParticipant[];\n maxRemoteVideoStreams: number;\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants: VideoGalleryParticipant[];\n}): VideoGalleryRemoteParticipant[] => {\n if (args.isScreenShareActive) {\n // If screen sharing is active, assign video and audio participants as overflow gallery participants\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return args.gridParticipants.concat(args.overflowGalleryParticipants.concat(args.callingParticipants));\n return args.gridParticipants.concat(args.overflowGalleryParticipants);\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 // if there are more overflow tiles than max streams then find the tiles that don't fit in the grid and put them in overflow\n // overflow should be empty if total participants including calling participants is less than max streams\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return args.gridParticipants.length > 0\n ? args.overflowGalleryParticipants.concat(args.callingParticipants)\n : args.overflowGalleryParticipants.length > args.maxRemoteVideoStreams\n ? args.overflowGalleryParticipants.slice(args.maxRemoteVideoStreams).concat(args.callingParticipants)\n : [];\n return args.gridParticipants.length > 0\n ? args.overflowGalleryParticipants\n : args.overflowGalleryParticipants.slice(args.maxRemoteVideoStreams);\n }\n};\n\nconst putVideoParticipantsFirst = (\n remoteParticipants: VideoGalleryRemoteParticipant[]\n): VideoGalleryRemoteParticipant[] => {\n const videoParticipants: VideoGalleryRemoteParticipant[] = [];\n const audioParticipants: VideoGalleryRemoteParticipant[] = [];\n remoteParticipants.forEach((p) => {\n if (p.videoStream?.isAvailable) {\n videoParticipants.push(p);\n } else {\n audioParticipants.push(p);\n }\n });\n const remoteParticipantSortedByVideo = videoParticipants.concat(audioParticipants);\n return remoteParticipantSortedByVideo;\n};\n\n/* @conditional-compile-remove(reaction) */\n/**\n * @private\n */\nexport const getEmojiResource = (reactionName: string, reactionResources: ReactionResources): string | undefined => {\n switch (reactionName) {\n case 'like':\n return reactionResources.likeReaction?.url;\n case 'heart':\n return reactionResources.heartReaction?.url;\n case 'laugh':\n return reactionResources.laughReaction?.url;\n case 'applause':\n return reactionResources.applauseReaction?.url;\n case 'surprised':\n return reactionResources.surprisedReaction?.url;\n }\n return '';\n};\n"]}
|
@@ -204,21 +204,21 @@ export interface VideoGalleryProps {
|
|
204
204
|
*/
|
205
205
|
spotlightedParticipants?: string[];
|
206
206
|
/**
|
207
|
-
* This callback
|
207
|
+
* This callback is to start spotlight for local participant video tile.
|
208
208
|
*/
|
209
209
|
onStartLocalSpotlight?: () => Promise<void>;
|
210
210
|
/**
|
211
|
-
* This callback
|
211
|
+
* This callback is to stop spotlight for local participant video tile.
|
212
212
|
*/
|
213
|
-
onStartRemoteSpotlight?: (userIds
|
213
|
+
onStartRemoteSpotlight?: (userIds: string[]) => Promise<void>;
|
214
214
|
/**
|
215
|
-
* This callback
|
215
|
+
* This callback is to start spotlight for remote participant video tiles.
|
216
216
|
*/
|
217
217
|
onStopLocalSpotlight?: () => Promise<void>;
|
218
218
|
/**
|
219
|
-
* This callback
|
219
|
+
* This callback is to stop spotlight for remote participant video tiles.
|
220
220
|
*/
|
221
|
-
onStopRemoteSpotlight?: (userIds
|
221
|
+
onStopRemoteSpotlight?: (userIds: string[]) => Promise<void>;
|
222
222
|
/**
|
223
223
|
* Maximum participants that can be spotlighted
|
224
224
|
*/
|