Skip to content

Commit 57a7c04

Browse files
Composite option to hide local screen share stream (#5699)
* update * Change files * update --------- Co-authored-by: Donald McEachern <[email protected]>
1 parent 6fa87ae commit 57a7c04

File tree

9 files changed

+75
-4
lines changed

9 files changed

+75
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "prerelease",
3+
"area": "feature",
4+
"workstream": "local screenshare",
5+
"comment": "Composite option to hide local screenshare stream",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}

packages/communication-react/review/beta/communication-react.api.md

+3
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ export type CallCompositeOptions = {
778778
disableAutoShowDtmfDialer?: boolean | DtmfDialPadOptions;
779779
galleryOptions?: {
780780
layout?: VideoGalleryLayout;
781+
localScreenShareView?: 'stream' | 'placeholderMessage';
781782
};
782783
surveyOptions?: {
783784
disableSurvey?: boolean;
@@ -1622,6 +1623,7 @@ export type CallWithChatCompositeOptions = {
16221623
localVideoTile?: boolean | LocalVideoTileOptions;
16231624
galleryOptions?: {
16241625
layout?: VideoGalleryLayout;
1626+
localScreenShareView?: 'stream' | 'placeholderMessage';
16251627
};
16261628
surveyOptions?: {
16271629
disableSurvey?: boolean;
@@ -5624,6 +5626,7 @@ export interface VideoGalleryProps {
56245626
isTogetherModeActive?: boolean;
56255627
layout?: VideoGalleryLayout;
56265628
localParticipant: VideoGalleryLocalParticipant;
5629+
localScreenShareView?: 'stream' | 'placeholderMessage';
56275630
localVideoCameraCycleButtonProps?: LocalVideoCameraCycleButtonProps;
56285631
localVideoTileSize?: LocalVideoTileSize;
56295632
localVideoViewOptions?: VideoStreamOptions;

packages/communication-react/review/stable/communication-react.api.md

+3
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ export type CallCompositeOptions = {
611611
disableAutoShowDtmfDialer?: boolean | DtmfDialPadOptions;
612612
galleryOptions?: {
613613
layout?: VideoGalleryLayout;
614+
localScreenShareView?: 'stream' | 'placeholderMessage';
614615
};
615616
surveyOptions?: {
616617
disableSurvey?: boolean;
@@ -1389,6 +1390,7 @@ export type CallWithChatCompositeOptions = {
13891390
localVideoTile?: boolean | LocalVideoTileOptions;
13901391
galleryOptions?: {
13911392
layout?: VideoGalleryLayout;
1393+
localScreenShareView?: 'stream' | 'placeholderMessage';
13921394
};
13931395
surveyOptions?: {
13941396
disableSurvey?: boolean;
@@ -4787,6 +4789,7 @@ export interface VideoGalleryProps {
47874789
dominantSpeakers?: string[];
47884790
layout?: VideoGalleryLayout;
47894791
localParticipant: VideoGalleryLocalParticipant;
4792+
localScreenShareView?: 'stream' | 'placeholderMessage';
47904793
localVideoCameraCycleButtonProps?: LocalVideoCameraCycleButtonProps;
47914794
localVideoTileSize?: LocalVideoTileSize;
47924795
localVideoViewOptions?: VideoStreamOptions;

packages/react-components/src/components/VideoGallery.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ export interface VideoGalleryProps {
387387
* This callback is to permit video for remote participant(s)
388388
*/
389389
onPermitVideo?: (userIds: string[]) => Promise<void>;
390+
/**
391+
* Controls the view of the local screenshare stream in the gallery
392+
*/
393+
localScreenShareView?: 'stream' | 'placeholderMessage';
390394
}
391395

392396
/**
@@ -491,7 +495,8 @@ export const VideoGallery = (props: VideoGalleryProps): JSX.Element => {
491495
onForbidAudio,
492496
onPermitAudio,
493497
onForbidVideo,
494-
onPermitVideo
498+
onPermitVideo,
499+
localScreenShareView
495500
} = props;
496501

497502
const ids = useIdentifiers();
@@ -786,6 +791,7 @@ export const VideoGallery = (props: VideoGalleryProps): JSX.Element => {
786791
isAvailable={localParticipant.screenShareStream?.isAvailable}
787792
onCreateLocalStreamView={onCreateLocalStreamView}
788793
onDisposeLocalScreenShareStreamView={onDisposeLocalScreenShareStreamView}
794+
localScreenShareView={localScreenShareView}
789795
/>
790796
);
791797

packages/react-components/src/components/VideoGallery/LocalScreenShare.tsx

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
import { Icon, Stack, Text } from '@fluentui/react';
45
import React, { useEffect } from 'react';
56
import { useLocale } from '../../localization';
7+
import { useTheme } from '../../theming';
68
import { CreateVideoStreamViewResult, VideoGalleryLocalParticipant, VideoStreamOptions } from '../../types';
79
import { VideoTile } from '../VideoTile';
810
import { StreamMedia } from '../StreamMedia';
911
import { LoadingSpinner } from './RemoteScreenShare';
1012
import { _formatString } from '@internal/acs-ui-common';
13+
import {
14+
screenSharingContainerStyle,
15+
screenSharingNotificationContainerStyle,
16+
screenSharingNotificationIconContainerStyle,
17+
screenSharingNotificationIconStyle,
18+
screenSharingNotificationTextStyle
19+
} from './styles/LocalScreenShare.styles';
1120

1221
/**
1322
* A memoized version of local screen share component. React.memo is used for a performance
@@ -21,16 +30,19 @@ export const LocalScreenShare = React.memo(
2130
isAvailable?: boolean;
2231
onCreateLocalStreamView?: (options?: VideoStreamOptions) => Promise<void | CreateVideoStreamViewResult>;
2332
onDisposeLocalScreenShareStreamView?: () => Promise<void>;
33+
localScreenShareView?: 'stream' | 'placeholderMessage';
2434
}) => {
2535
const {
2636
localParticipant,
2737
renderElement,
2838
isAvailable,
2939
onCreateLocalStreamView,
30-
onDisposeLocalScreenShareStreamView
40+
onDisposeLocalScreenShareStreamView,
41+
localScreenShareView = 'stream'
3142
} = props;
3243
const locale = useLocale();
33-
if (!renderElement) {
44+
const theme = useTheme();
45+
if (!renderElement && localScreenShareView === 'stream') {
3446
onCreateLocalStreamView && onCreateLocalStreamView();
3547
}
3648

@@ -44,13 +56,38 @@ export const LocalScreenShare = React.memo(
4456
if (!localParticipant || !localParticipant.isScreenSharingOn) {
4557
return null;
4658
}
59+
const localScreenSharingPlaceholder = (
60+
<Stack horizontalAlign="center" verticalAlign="center" className={screenSharingContainerStyle}>
61+
<Stack
62+
horizontalAlign="center"
63+
verticalAlign="center"
64+
className={screenSharingNotificationContainerStyle(theme)}
65+
tokens={{ childrenGap: '1rem' }}
66+
>
67+
<Stack horizontal verticalAlign="center" className={screenSharingNotificationIconContainerStyle}>
68+
<Icon iconName="ControlButtonScreenShareStart" className={screenSharingNotificationIconStyle(theme)} />
69+
</Stack>
70+
<Text className={screenSharingNotificationTextStyle} aria-live="polite">
71+
{locale.strings.videoGallery.screenIsBeingSharedMessage}
72+
</Text>
73+
</Stack>
74+
</Stack>
75+
);
4776

4877
const displayName = !localParticipant?.displayName
4978
? locale.strings.videoGallery.displayNamePlaceholder
5079
: localParticipant?.displayName;
5180

5281
const loadingMessage = locale.strings.videoGallery.localScreenShareLoadingMessage;
5382

83+
if (localScreenShareView === 'placeholderMessage') {
84+
return (
85+
<VideoTile displayName={displayName} isMuted={localParticipant?.isMuted} onRenderPlaceholder={() => <></>}>
86+
{localScreenSharingPlaceholder}
87+
</VideoTile>
88+
);
89+
}
90+
5491
return (
5592
<VideoTile
5693
displayName={displayName}

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

+4
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ export type CallCompositeOptions = {
262262
* Layout for the gallery when the call starts
263263
*/
264264
layout?: VideoGalleryLayout;
265+
/**
266+
* Controls the view of the local screenshare stream in the gallery
267+
*/
268+
localScreenShareView?: 'stream' | 'placeholderMessage';
265269
};
266270
/**
267271
* Options for end of call survey

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface MediaGalleryProps {
6969
captionsOptions?: {
7070
height: 'full' | 'default';
7171
};
72+
localScreenShareView?: 'stream' | 'placeholderMessage';
7273
}
7374

7475
/**
@@ -224,6 +225,7 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
224225
? videoGalleryProps.onMuteParticipant
225226
: undefined
226227
}
228+
localScreenShareView={props.localScreenShareView}
227229
/>
228230
);
229231
}, [
@@ -250,7 +252,8 @@ export const MediaGallery = (props: MediaGalleryProps): JSX.Element => {
250252
onStartRemoteSpotlightWithPrompt,
251253
onStopRemoteSpotlightWithPrompt,
252254
layoutBasedOnTilePosition,
253-
capabilities?.muteOthers
255+
capabilities?.muteOthers,
256+
props.localScreenShareView
254257
]);
255258

256259
return (

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

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export const CallPage = (props: CallPageProps): JSX.Element => {
200200
hideSpotlightButtons={options?.spotlight?.hideSpotlightButtons}
201201
videoTilesOptions={options?.videoTilesOptions}
202202
captionsOptions={options?.captionsBanner}
203+
localScreenShareView={options?.galleryOptions?.localScreenShareView}
203204
/>
204205
);
205206
}

packages/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ export type CallWithChatCompositeOptions = {
185185
* Layout for the gallery when the call starts
186186
*/
187187
layout?: VideoGalleryLayout;
188+
/**
189+
* Controls the view of the local screenshare stream in the gallery
190+
*/
191+
localScreenShareView?: 'stream' | 'placeholderMessage';
188192
};
189193
/**
190194
* Options for end of call survey
@@ -321,6 +325,7 @@ type CallWithChatScreenProps = {
321325
localVideoTile?: boolean | LocalVideoTileOptions;
322326
galleryOptions?: {
323327
layout?: VideoGalleryLayout;
328+
localScreenShareView?: 'stream' | 'placeholderMessage';
324329
};
325330
/**
326331
* Options for end of call survey

0 commit comments

Comments
 (0)