@@ -27,11 +27,14 @@ export const StreamRenderer = forwardRef(({
27
27
const [ displayName , setDisplayName ] = useState ( remoteParticipant ?. displayName ?. trim ( ) ?? '' ) ;
28
28
const [ videoStats , setVideoStats ] = useState ( ) ;
29
29
const [ transportStats , setTransportStats ] = useState ( ) ;
30
+ const [ height , setHeight ] = useState ( stream . size . height ) ;
31
+ const [ width , setWidth ] = useState ( stream . size . width ) ;
30
32
31
33
useEffect ( ( ) => {
32
34
initializeComponent ( ) ;
33
35
return ( ) => {
34
36
stream . off ( 'isReceivingChanged' , isReceivingChanged ) ;
37
+ stream . off ( 'sizeChanged' , sizeChanged ) ;
35
38
remoteParticipant . off ( 'isSpeakingChanged' , isSpeakingChanged ) ;
36
39
remoteParticipant . off ( 'isMutedChanged' , isMutedChanged ) ;
37
40
remoteParticipant . off ( 'displayNameChanged' , isDisplayNameChanged ) ;
@@ -94,6 +97,11 @@ export const StreamRenderer = forwardRef(({
94
97
}
95
98
} ;
96
99
100
+ const sizeChanged = ( ) => {
101
+ setHeight ( stream . size . height ) ;
102
+ setWidth ( stream . size . width ) ;
103
+ }
104
+
97
105
const isMutedChanged = ( ) => {
98
106
setIsMuted ( remoteParticipant && remoteParticipant ?. isMuted ) ;
99
107
} ;
@@ -110,6 +118,7 @@ export const StreamRenderer = forwardRef(({
110
118
*/
111
119
const initializeComponent = async ( ) => {
112
120
stream . on ( 'isReceivingChanged' , isReceivingChanged ) ;
121
+ stream . on ( 'sizeChanged' , sizeChanged ) ;
113
122
remoteParticipant . on ( 'isMutedChanged' , isMutedChanged ) ;
114
123
remoteParticipant . on ( 'isSpeakingChanged' , isSpeakingChanged ) ;
115
124
if ( dominantSpeakerMode && dominantRemoteParticipant !== remoteParticipant ) {
@@ -149,9 +158,11 @@ export const StreamRenderer = forwardRef(({
149
158
${ stream . mediaStreamType === 'ScreenSharing' ? `ms-xxl12` : `` }
150
159
${ stream . isAvailable ? 'rendering' : '' }
151
160
${ isPinned ? 'pinned' : ( isPinningActive ? 'pinning-is-active' : '' ) } ` } >
152
- < div className = { `remote-video-container ${ isSpeaking && ! isMuted ? `speaking-border-for-video` : `` } ` }
153
- id = { videoContainerId }
154
- ref = { videoContainer } >
161
+ < div id = { videoContainerId }
162
+ ref = { videoContainer }
163
+ className = { `remote-video-container ${ isSpeaking && ! isMuted ? `speaking-border-for-video` : `` }
164
+ ${ isPinned ? 'pinned' : ( isPinningActive ? 'pinning-is-active' : '' ) }
165
+ ${ height > width ? 'portrait' : '' } ` } >
155
166
< h4 className = "video-title" >
156
167
{ displayName ? displayName : remoteParticipant . displayName ? remoteParticipant . displayName : utils . getIdentifierText ( remoteParticipant . identifier ) }
157
168
</ h4 >
@@ -172,13 +183,13 @@ export const StreamRenderer = forwardRef(({
172
183
{
173
184
isLoading && < div className = "remote-video-loading-spinner" > </ div >
174
185
}
186
+ {
187
+ videoStats && showMediaStats &&
188
+ < h4 className = "video-stats" >
189
+ < VideoReceiveStats videoStats = { videoStats } transportStats = { transportStats } />
190
+ </ h4 >
191
+ }
175
192
</ div >
176
- {
177
- videoStats && showMediaStats &&
178
- < h4 className = "video-stats" >
179
- < VideoReceiveStats videoStats = { videoStats } transportStats = { transportStats } />
180
- </ h4 >
181
- }
182
193
</ div >
183
194
) ;
184
195
}
0 commit comments