@@ -182,9 +182,10 @@ let VideoCompBuilder = (function (props) {
182182 return new UICompBuilder ( meetingStreamChildren , ( props ) => {
183183 const videoRef = useRef < HTMLVideoElement > ( null ) ;
184184 const conRef = useRef < HTMLDivElement > ( null ) ;
185- const userNameRef = useRef < HTMLDivElement > ( null ) ;
185+ const placeholderRef = useRef < HTMLDivElement > ( null ) ;
186186 const [ userId , setUserId ] = useState ( ) ;
187187 const [ userName , setUsername ] = useState ( "" ) ;
188+ const [ showVideo , setVideo ] = useState ( true ) ;
188189
189190 useEffect ( ( ) => {
190191 onResize ( ) ;
@@ -209,10 +210,10 @@ let VideoCompBuilder = (function (props) {
209210 ) {
210211 if ( videoRef . current && videoRef . current ?. id == userId + "" ) {
211212 videoRef . current . srcObject = null ;
212- if ( userNameRef . current ) {
213- userNameRef . current . textContent = userData . user ;
214- }
213+ setVideo ( false ) ;
215214 }
215+ } else {
216+ setVideo ( true ) ;
216217 }
217218 client . on (
218219 "user-published" ,
@@ -228,6 +229,7 @@ let VideoCompBuilder = (function (props) {
228229 props . onEvent ( "videoOn" ) ;
229230 }
230231 const element = document . getElementById ( userId ) ;
232+
231233 if ( element ) {
232234 remoteTrack . play ( userId ) ;
233235 }
@@ -276,7 +278,7 @@ let VideoCompBuilder = (function (props) {
276278 ) ;
277279
278280 setUserId ( userData . user ) ;
279- setUsername ( userData . user ) ;
281+ setUsername ( userData . userName ) ;
280282 }
281283 } , [ props . userId . value ] ) ;
282284
@@ -286,13 +288,25 @@ let VideoCompBuilder = (function (props) {
286288 < ReactResizeDetector onResize = { onResize } >
287289 < Container ref = { conRef } $style = { props . style } >
288290 { props . shareScreen || userId ? (
291+ < >
289292 < VideoContainer
290293 onClick = { ( ) => props . onEvent ( "videoClicked" ) }
291294 ref = { videoRef }
295+ style = { { display : `${ showVideo ? "flex" : "none" } ` } }
292296 $style = { props . style }
293297 id = { props . shareScreen ? "share-screen" : userId }
294298 > </ VideoContainer >
299+ < TextContainer
300+ onClick = { ( ) => props . onEvent ( "videoClicked" ) }
301+ ref = { placeholderRef }
302+ style = { { display : `${ ! showVideo ? "flex" : "none" } ` } }
303+ $style = { props . style }
304+ >
305+ { userName ?? "No Username" }
306+ </ TextContainer >
307+ </ >
295308 ) : (
309+ // )
296310 < TextContainer $style = { props . style } >
297311 < p > No Video</ p >
298312 </ TextContainer >
0 commit comments