@@ -27,11 +27,14 @@ export const StreamRenderer = forwardRef(({
2727 const [ displayName , setDisplayName ] = useState ( remoteParticipant ?. displayName ?. trim ( ) ?? '' ) ;
2828 const [ videoStats , setVideoStats ] = useState ( ) ;
2929 const [ transportStats , setTransportStats ] = useState ( ) ;
30+ const [ height , setHeight ] = useState ( stream . size . height ) ;
31+ const [ width , setWidth ] = useState ( stream . size . width ) ;
3032
3133 useEffect ( ( ) => {
3234 initializeComponent ( ) ;
3335 return ( ) => {
3436 stream . off ( 'isReceivingChanged' , isReceivingChanged ) ;
37+ stream . off ( 'sizeChanged' , sizeChanged ) ;
3538 remoteParticipant . off ( 'isSpeakingChanged' , isSpeakingChanged ) ;
3639 remoteParticipant . off ( 'isMutedChanged' , isMutedChanged ) ;
3740 remoteParticipant . off ( 'displayNameChanged' , isDisplayNameChanged ) ;
@@ -94,6 +97,11 @@ export const StreamRenderer = forwardRef(({
9497 }
9598 } ;
9699
100+ const sizeChanged = ( ) => {
101+ setHeight ( stream . size . height ) ;
102+ setWidth ( stream . size . width ) ;
103+ }
104+
97105 const isMutedChanged = ( ) => {
98106 setIsMuted ( remoteParticipant && remoteParticipant ?. isMuted ) ;
99107 } ;
@@ -110,6 +118,7 @@ export const StreamRenderer = forwardRef(({
110118 */
111119 const initializeComponent = async ( ) => {
112120 stream . on ( 'isReceivingChanged' , isReceivingChanged ) ;
121+ stream . on ( 'sizeChanged' , sizeChanged ) ;
113122 remoteParticipant . on ( 'isMutedChanged' , isMutedChanged ) ;
114123 remoteParticipant . on ( 'isSpeakingChanged' , isSpeakingChanged ) ;
115124 if ( dominantSpeakerMode && dominantRemoteParticipant !== remoteParticipant ) {
@@ -149,9 +158,11 @@ export const StreamRenderer = forwardRef(({
149158 ${ stream . mediaStreamType === 'ScreenSharing' ? `ms-xxl12` : `` }
150159 ${ stream . isAvailable ? 'rendering' : '' }
151160 ${ 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' : '' } ` } >
155166 < h4 className = "video-title" >
156167 { displayName ? displayName : remoteParticipant . displayName ? remoteParticipant . displayName : utils . getIdentifierText ( remoteParticipant . identifier ) }
157168 </ h4 >
@@ -172,13 +183,13 @@ export const StreamRenderer = forwardRef(({
172183 {
173184 isLoading && < div className = "remote-video-loading-spinner" > </ div >
174185 }
186+ {
187+ videoStats && showMediaStats &&
188+ < h4 className = "video-stats" >
189+ < VideoReceiveStats videoStats = { videoStats } transportStats = { transportStats } />
190+ </ h4 >
191+ }
175192 </ div >
176- {
177- videoStats && showMediaStats &&
178- < h4 className = "video-stats" >
179- < VideoReceiveStats videoStats = { videoStats } transportStats = { transportStats } />
180- </ h4 >
181- }
182193 </ div >
183194 ) ;
184195 }
0 commit comments