@@ -8,12 +8,9 @@ import {
8
8
import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
9
9
import { BoolControl } from "comps/controls/boolControl" ;
10
10
import {
11
- JSONObjectArrayControl ,
12
- NumberControl ,
13
11
StringControl ,
14
12
} from "comps/controls/codeControl" ;
15
13
import {
16
- arrayStringExposingStateControl ,
17
14
booleanExposingStateControl ,
18
15
jsonObjectExposingStateControl ,
19
16
jsonValueExposingStateControl ,
@@ -39,22 +36,19 @@ import {
39
36
Section ,
40
37
sectionNames ,
41
38
} from "lowcoder-design" ;
42
- import { useCallback , useEffect , useState } from "react" ;
39
+ import { useCallback , useEffect } from "react" ;
43
40
import { ResizeHandle } from "react-resizable" ;
44
41
import styled from "styled-components" ;
45
42
import { useUserViewMode } from "util/hooks" ;
46
43
import { isNumeric } from "util/stringUtils" ;
47
- import { NameConfig , withExposingConfigs } from "../generators/withExposing" ;
48
- import { v4 as uuidv4 } from "uuid" ;
44
+ import { NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
49
45
50
46
import AgoraRTC , {
51
47
ICameraVideoTrack ,
52
48
IMicrophoneAudioTrack ,
53
49
IAgoraRTCClient ,
54
50
IAgoraRTCRemoteUser ,
55
- IRemoteVideoTrack ,
56
51
} from "agora-rtc-sdk-ng" ;
57
- import { JSONObject } from "@lowcoder-ee/index.sdk" ;
58
52
59
53
const EventOptions = [ closeEvent ] as const ;
60
54
@@ -100,24 +94,6 @@ function transToPxSize(size: string | number) {
100
94
return isNumeric ( size ) ? size + "px" : ( size as string ) ;
101
95
}
102
96
103
- const PlacementOptions = [
104
- {
105
- label : trans ( "drawer.top" ) ,
106
- value : "top" ,
107
- } ,
108
- {
109
- label : trans ( "drawer.right" ) ,
110
- value : "right" ,
111
- } ,
112
- {
113
- label : trans ( "drawer.bottom" ) ,
114
- value : "bottom" ,
115
- } ,
116
- {
117
- label : trans ( "drawer.left" ) ,
118
- value : "left" ,
119
- } ,
120
- ] as const ;
121
97
122
98
let client : IAgoraRTCClient = AgoraRTC . createClient ( {
123
99
mode : "rtc" ,
@@ -144,8 +120,6 @@ const turnOnMicrophone = async (flag?: boolean) => {
144
120
} ;
145
121
146
122
const leaveChannel = async ( ) => {
147
- console . log ( "isJoined" , isJoined ) ;
148
-
149
123
if ( ! client ) {
150
124
console . error ( "Agora client is not initialized" ) ;
151
125
return ;
@@ -156,19 +130,19 @@ const leaveChannel = async () => {
156
130
return ;
157
131
}
158
132
if ( videoTrack ) {
159
- // await turnOnCamera(false);
133
+ await turnOnCamera ( false ) ;
160
134
await client . unpublish ( videoTrack ) ;
161
135
videoTrack . stop ( ) ;
162
136
}
163
137
164
138
if ( audioTrack ) {
165
- // await turnOnMicrophone(false);
139
+ await turnOnMicrophone ( false ) ;
166
140
await client . unpublish ( audioTrack ) ;
167
141
audioTrack . stop ( ) ;
168
142
}
169
143
170
144
await client . leave ( ) ;
171
- isJoined = false ; // Update the flag to indicate that you have left the channel
145
+ isJoined = false ;
172
146
} ;
173
147
let isJoined = false ;
174
148
@@ -181,8 +155,6 @@ const joinChannel = async (appId: any, channel: any, token: any) => {
181
155
await leaveChannel ( ) ;
182
156
}
183
157
184
- // client.on("user-published", onUserPublish);
185
-
186
158
await client . join (
187
159
appId ,
188
160
channel ,
@@ -194,19 +166,14 @@ const joinChannel = async (appId: any, channel: any, token: any) => {
194
166
} ;
195
167
196
168
const publishVideo = async ( appId : any , channel : any , height : any ) => {
197
- console . log ( "publishVideo" , appId , channel , isJoined ) ;
198
169
await turnOnCamera ( true ) ;
199
170
console . log ( appId , channel ) ;
200
171
201
172
if ( ! isJoined ) {
202
173
await joinChannel ( appId , channel , null ) ;
203
174
}
204
175
205
- console . log ( "publish videoTrack " , videoTrack ) ;
206
-
207
176
await client . publish ( videoTrack ) ;
208
-
209
- // turnOnCamera(true);
210
177
const mediaStreamTrack = videoTrack . getMediaStreamTrack ( ) ;
211
178
212
179
if ( mediaStreamTrack ) {
@@ -276,16 +243,12 @@ let MTComp = (function () {
276
243
[ dispatch , isTopBom ]
277
244
) ;
278
245
279
- const usersWithVideoTracks : any = { } ;
280
-
281
246
useEffect ( ( ) => {
282
247
console . log ( "nnnn " , props . participants ) ;
283
248
} , [ props . participants . value ] ) ;
284
249
285
250
useEffect ( ( ) => {
286
251
if ( client ) {
287
- console . log ( "REGISTERING LISTNERS" ) ;
288
-
289
252
client . on (
290
253
"user-published" ,
291
254
async ( user : IAgoraRTCRemoteUser , mediaType : "video" | "audio" ) => {
@@ -297,26 +260,10 @@ let MTComp = (function () {
297
260
const remoteTrack = await client . subscribe ( user , mediaType ) ;
298
261
remoteTrack . play ( ) ;
299
262
}
300
- const remoteVideoTrack = user . videoTrack ;
301
- if ( remoteVideoTrack ) {
302
- props . participants . onChange ( [ JSON . stringify ( user . uid ) ] ) ;
303
- console . log ( "usersWithVideoTracks" , props . participants ) ;
304
- }
305
263
}
306
264
) ;
307
265
308
- client . on ( "user-joined" , ( user : IAgoraRTCRemoteUser ) => {
309
- // usersWithVideoTracks[user.uid] = { user, videoTracks: [] };
310
- // props.participants.onChange(usersWithVideoTracks);
311
- // console.log(
312
- // "userJoined",
313
- // user.uid,
314
- // props.participants.value,
315
- // usersWithVideoTracks
316
- // );
317
- // const uid = user.uid;
318
- // usersWithVideoTracks[uid] = { user, videoTracks: [] };
319
- } ) ;
266
+ client . on ( "user-joined" , ( user : IAgoraRTCRemoteUser ) => { } ) ;
320
267
client . on ( "user-offline" , ( uid : any , reason : any ) => {
321
268
console . log ( `User ${ uid } left the channel.` ) ;
322
269
} ) ;
@@ -328,13 +275,8 @@ let MTComp = (function () {
328
275
} ) ;
329
276
client . on ( "stream-added" , ( user : IAgoraRTCRemoteUser ) => {
330
277
console . log ( "stream-added" ) ;
331
-
332
- if ( user . hasVideo ) {
333
- console . log ( `Stream from user ${ user . videoTrack } added.` ) ;
334
- }
335
278
} ) ;
336
279
}
337
- // turnOnCamera(true);
338
280
} , [ client ] ) ;
339
281
340
282
return (
0 commit comments