@@ -33,9 +33,7 @@ import { client } from "./videoMeetingControllerComp";
3333import { IAgoraRTCRemoteUser } from "agora-rtc-sdk-ng" ;
3434
3535import {
36- ControlParams ,
3736 MeetingEventHandlerControl ,
38- SimpleComp ,
3937 StringControl ,
4038 StringStateControl ,
4139 hiddenPropertyView ,
@@ -57,44 +55,15 @@ function getFormOptions(editorState: EditorState) {
5755 value : info . name ,
5856 } ) ) ;
5957}
60- const Container = styled . div < { $style : any } > `
61- height: 100%;
62- width: 100%;
63- display: flex;
64- align-items: center;
65- justify-content: center;
66- ` ;
67- const TextContainer = styled . div < { $style : any } > `
68- height: 100%;
69- width: 100%;
70- display: flex;
71- align-items: center;
72- position: absolute;
73- justify-content: center;
74- ${ ( props ) => props . $style && getStyle ( props . $style ) }
75- ` ;
7658
77- const VideoContainer = styled . video < { $style : any } > `
59+ const VideoContainer = styled . video `
7860 height: 100%;
7961 width: 100%;
8062 display: flex;
8163 align-items: center;
8264 justify-content: center;
83- ${ ( props ) => props . $style && getStyle ( props . $style ) }
8465` ;
8566
86- const getStyle = ( style : any ) => {
87- return css `
88- {
89- border : 1px solid ${ style . border } ;
90- border-radius : ${ style . radius } ;
91- margin : ${ style . margin } ;
92- padding : ${ style . padding } ;
93- background-color : ${ style . background } ;
94- }
95- ` ;
96- } ;
97-
9867function getForm ( editorState : EditorState , formName : string ) {
9968 const comp = editorState ?. getUICompByName ( formName ) ;
10069 if ( comp && comp . children . compType . getView ( ) === "form" ) {
@@ -192,23 +161,10 @@ let VideoCompBuilder = (function (props) {
192161 return new UICompBuilder ( meetingStreamChildren , ( props ) => {
193162 const videoRef = useRef < HTMLVideoElement > ( null ) ;
194163 const conRef = useRef < HTMLDivElement > ( null ) ;
195- const placeholderRef = useRef < HTMLDivElement > ( null ) ;
196164 const [ userId , setUserId ] = useState ( ) ;
197165 const [ userName , setUsername ] = useState ( "" ) ;
198166 const [ showVideo , setVideo ] = useState ( true ) ;
199167
200- useEffect ( ( ) => {
201- onResize ( ) ;
202- } , [ ] ) ;
203-
204- const onResize = async ( ) => {
205- const container = conRef . current ;
206- let videoCo = videoRef . current ;
207- if ( videoCo ) {
208- videoCo ! . style . height = container ?. clientHeight + "px" ;
209- videoCo ! . style . width = container ?. clientWidth + "px" ;
210- }
211- } ;
212168 useEffect ( ( ) => {
213169 if ( props . userId . value !== "" ) {
214170 let userData = JSON . parse ( props . userId ?. value ) ;
@@ -289,55 +245,84 @@ let VideoCompBuilder = (function (props) {
289245
290246 setUserId ( userData . user ) ;
291247 setUsername ( userData . userName ) ;
248+ console . log ( userData ) ;
292249 }
293250 } , [ props . userId . value ] ) ;
294251
295252 return (
296253 < EditorContext . Consumer >
297254 { ( editorState ) => (
298- < ReactResizeDetector onResize = { onResize } >
299- < Container ref = { conRef } $style = { props . style } >
255+ < ReactResizeDetector >
256+ < div
257+ ref = { conRef }
258+ style = { {
259+ display : "flex" ,
260+ alignItems : "center" ,
261+ height : "100%" ,
262+ overflow : "hidden" ,
263+ borderRadius : props . style . radius ,
264+ aspectRatio : "1 / 1" ,
265+ backgroundColor : props . style . background ,
266+ padding : props . style . padding ,
267+ margin : props . style . margin ,
268+ } }
269+ >
300270 { userId ? (
301- < >
271+ showVideo ? (
302272 < VideoContainer
303273 onClick = { ( ) => props . onEvent ( "videoClicked" ) }
304274 ref = { videoRef }
305- style = { { display : `${ showVideo ? "flex" : "none" } ` } }
306- $style = { props . style }
275+ style = { {
276+ display : `${ showVideo ? "flex" : "none" } ` ,
277+ aspectRatio : "1 / 1" ,
278+ borderRadius : props . style . radius ,
279+ width : "auto" ,
280+ } }
307281 id = { props . shareScreen ? "share-screen" : userId }
308282 > </ VideoContainer >
309- < TextContainer
310- onClick = { ( ) => props . onEvent ( "videoClicked" ) }
311- ref = { placeholderRef }
283+ ) : (
284+ < div
312285 style = { {
313- display : `${ ! showVideo ? "flex" : "none" } ` ,
314286 flexDirection : "column" ,
287+ display : "flex" ,
288+ alignItems : "center" ,
289+ margin : "0 auto" ,
290+ padding : props . profilePadding ,
315291 } }
316- $style = { props . style }
317292 >
318293 < img
319294 style = { {
320- padding : props . profilePadding ,
321295 borderRadius : props . profileBorderRadius ,
296+ width : "100%" ,
297+ overflow : "hidden" ,
322298 } }
323299 src = { props . profileImageUrl . value }
324300 />
325- { userName ?? "No Username" }
326- </ TextContainer >
327- </ >
301+ < p style = { { margin : "0" } } > { userName ?? "" } </ p >
302+ </ div >
303+ )
328304 ) : (
329- < TextContainer $style = { props . style } >
305+ < div
306+ style = { {
307+ flexDirection : "column" ,
308+ display : "flex" ,
309+ alignItems : "center" ,
310+ margin : "0 auto" ,
311+ padding : props . profilePadding ,
312+ } }
313+ >
330314 < img
331315 style = { {
332- padding : props . profilePadding ,
333- width : "100%" ,
334316 borderRadius : props . profileBorderRadius ,
317+ width : "100%" ,
318+ overflow : "hidden" ,
335319 } }
336320 src = { props . profileImageUrl . value }
337321 />
338- </ TextContainer >
322+ < p style = { { margin : "0" } } > { userName ?? "" } </ p >
323+ </ div >
339324 ) }
340- </ Container >
325+ </ div >
341326 </ ReactResizeDetector >
342327 ) }
343328 </ EditorContext . Consumer >
0 commit comments