@@ -33,9 +33,7 @@ import { client } from "./videoMeetingControllerComp";
33
33
import { IAgoraRTCRemoteUser } from "agora-rtc-sdk-ng" ;
34
34
35
35
import {
36
- ControlParams ,
37
36
MeetingEventHandlerControl ,
38
- SimpleComp ,
39
37
StringControl ,
40
38
StringStateControl ,
41
39
hiddenPropertyView ,
@@ -57,44 +55,15 @@ function getFormOptions(editorState: EditorState) {
57
55
value : info . name ,
58
56
} ) ) ;
59
57
}
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
- ` ;
76
58
77
- const VideoContainer = styled . video < { $style : any } > `
59
+ const VideoContainer = styled . video `
78
60
height: 100%;
79
61
width: 100%;
80
62
display: flex;
81
63
align-items: center;
82
64
justify-content: center;
83
- ${ ( props ) => props . $style && getStyle ( props . $style ) }
84
65
` ;
85
66
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
-
98
67
function getForm ( editorState : EditorState , formName : string ) {
99
68
const comp = editorState ?. getUICompByName ( formName ) ;
100
69
if ( comp && comp . children . compType . getView ( ) === "form" ) {
@@ -192,23 +161,10 @@ let VideoCompBuilder = (function (props) {
192
161
return new UICompBuilder ( meetingStreamChildren , ( props ) => {
193
162
const videoRef = useRef < HTMLVideoElement > ( null ) ;
194
163
const conRef = useRef < HTMLDivElement > ( null ) ;
195
- const placeholderRef = useRef < HTMLDivElement > ( null ) ;
196
164
const [ userId , setUserId ] = useState ( ) ;
197
165
const [ userName , setUsername ] = useState ( "" ) ;
198
166
const [ showVideo , setVideo ] = useState ( true ) ;
199
167
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
- } ;
212
168
useEffect ( ( ) => {
213
169
if ( props . userId . value !== "" ) {
214
170
let userData = JSON . parse ( props . userId ?. value ) ;
@@ -289,55 +245,84 @@ let VideoCompBuilder = (function (props) {
289
245
290
246
setUserId ( userData . user ) ;
291
247
setUsername ( userData . userName ) ;
248
+ console . log ( userData ) ;
292
249
}
293
250
} , [ props . userId . value ] ) ;
294
251
295
252
return (
296
253
< EditorContext . Consumer >
297
254
{ ( 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
+ >
300
270
{ userId ? (
301
- < >
271
+ showVideo ? (
302
272
< VideoContainer
303
273
onClick = { ( ) => props . onEvent ( "videoClicked" ) }
304
274
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
+ } }
307
281
id = { props . shareScreen ? "share-screen" : userId }
308
282
> </ VideoContainer >
309
- < TextContainer
310
- onClick = { ( ) => props . onEvent ( "videoClicked" ) }
311
- ref = { placeholderRef }
283
+ ) : (
284
+ < div
312
285
style = { {
313
- display : `${ ! showVideo ? "flex" : "none" } ` ,
314
286
flexDirection : "column" ,
287
+ display : "flex" ,
288
+ alignItems : "center" ,
289
+ margin : "0 auto" ,
290
+ padding : props . profilePadding ,
315
291
} }
316
- $style = { props . style }
317
292
>
318
293
< img
319
294
style = { {
320
- padding : props . profilePadding ,
321
295
borderRadius : props . profileBorderRadius ,
296
+ width : "100%" ,
297
+ overflow : "hidden" ,
322
298
} }
323
299
src = { props . profileImageUrl . value }
324
300
/>
325
- { userName ?? "No Username" }
326
- </ TextContainer >
327
- </ >
301
+ < p style = { { margin : "0" } } > { userName ?? "" } </ p >
302
+ </ div >
303
+ )
328
304
) : (
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
+ >
330
314
< img
331
315
style = { {
332
- padding : props . profilePadding ,
333
- width : "100%" ,
334
316
borderRadius : props . profileBorderRadius ,
317
+ width : "100%" ,
318
+ overflow : "hidden" ,
335
319
} }
336
320
src = { props . profileImageUrl . value }
337
321
/>
338
- </ TextContainer >
322
+ < p style = { { margin : "0" } } > { userName ?? "" } </ p >
323
+ </ div >
339
324
) }
340
- </ Container >
325
+ </ div >
341
326
</ ReactResizeDetector >
342
327
) }
343
328
</ EditorContext . Consumer >
0 commit comments