1
1
// Copyright (c) Microsoft Corporation.
2
2
// Licensed under the MIT License.
3
3
4
+ import { Icon , Stack , Text } from '@fluentui/react' ;
4
5
import React , { useEffect } from 'react' ;
5
6
import { useLocale } from '../../localization' ;
7
+ import { useTheme } from '../../theming' ;
6
8
import { CreateVideoStreamViewResult , VideoGalleryLocalParticipant , VideoStreamOptions } from '../../types' ;
7
9
import { VideoTile } from '../VideoTile' ;
8
10
import { StreamMedia } from '../StreamMedia' ;
9
11
import { LoadingSpinner } from './RemoteScreenShare' ;
10
12
import { _formatString } from '@internal/acs-ui-common' ;
13
+ import {
14
+ screenSharingContainerStyle ,
15
+ screenSharingNotificationContainerStyle ,
16
+ screenSharingNotificationIconContainerStyle ,
17
+ screenSharingNotificationIconStyle ,
18
+ screenSharingNotificationTextStyle
19
+ } from './styles/LocalScreenShare.styles' ;
11
20
12
21
/**
13
22
* A memoized version of local screen share component. React.memo is used for a performance
@@ -21,16 +30,19 @@ export const LocalScreenShare = React.memo(
21
30
isAvailable ?: boolean ;
22
31
onCreateLocalStreamView ?: ( options ?: VideoStreamOptions ) => Promise < void | CreateVideoStreamViewResult > ;
23
32
onDisposeLocalScreenShareStreamView ?: ( ) => Promise < void > ;
33
+ localScreenShareView ?: 'stream' | 'placeholderMessage' ;
24
34
} ) => {
25
35
const {
26
36
localParticipant,
27
37
renderElement,
28
38
isAvailable,
29
39
onCreateLocalStreamView,
30
- onDisposeLocalScreenShareStreamView
40
+ onDisposeLocalScreenShareStreamView,
41
+ localScreenShareView = 'stream'
31
42
} = props ;
32
43
const locale = useLocale ( ) ;
33
- if ( ! renderElement ) {
44
+ const theme = useTheme ( ) ;
45
+ if ( ! renderElement && localScreenShareView === 'stream' ) {
34
46
onCreateLocalStreamView && onCreateLocalStreamView ( ) ;
35
47
}
36
48
@@ -44,13 +56,38 @@ export const LocalScreenShare = React.memo(
44
56
if ( ! localParticipant || ! localParticipant . isScreenSharingOn ) {
45
57
return null ;
46
58
}
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
+ ) ;
47
76
48
77
const displayName = ! localParticipant ?. displayName
49
78
? locale . strings . videoGallery . displayNamePlaceholder
50
79
: localParticipant ?. displayName ;
51
80
52
81
const loadingMessage = locale . strings . videoGallery . localScreenShareLoadingMessage ;
53
82
83
+ if ( localScreenShareView === 'placeholderMessage' ) {
84
+ return (
85
+ < VideoTile displayName = { displayName } isMuted = { localParticipant ?. isMuted } onRenderPlaceholder = { ( ) => < > </ > } >
86
+ { localScreenSharingPlaceholder }
87
+ </ VideoTile >
88
+ ) ;
89
+ }
90
+
54
91
return (
55
92
< VideoTile
56
93
displayName = { displayName }
0 commit comments