agora-appbuilder-core 4.0.22-beta-4 → 4.0.22-beta-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.22-beta-4",
3
+ "version": "4.0.22-beta-5",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -382,10 +382,6 @@ export default class RtcEngine {
382
382
  LogSource.AgoraSDK,
383
383
  'API',
384
384
  'RTC [createMicrophoneAndCameraTracks] audio and video tracks created successfully',
385
- {
386
- audio: localAudio,
387
- video: localVideo,
388
- },
389
385
  );
390
386
  this.localStream.audio = localAudio;
391
387
  this.localStream.video = localVideo;
@@ -422,7 +418,6 @@ export default class RtcEngine {
422
418
  LogSource.AgoraSDK,
423
419
  'API',
424
420
  'RTC [createMicrophoneAudioTrack] audio track created',
425
- localAudio,
426
421
  );
427
422
  } catch (eAudio) {
428
423
  logger.log(
@@ -442,7 +437,6 @@ export default class RtcEngine {
442
437
  LogSource.AgoraSDK,
443
438
  'API',
444
439
  'RTC [createMicrophoneAudioTrack] audio track created successfully',
445
- localAudio,
446
440
  );
447
441
  }
448
442
  this.localStream.audio = localAudio;
@@ -474,7 +468,6 @@ export default class RtcEngine {
474
468
  LogSource.AgoraSDK,
475
469
  'API',
476
470
  'RTC [createCameraVideoTrack] video track created successfully',
477
- localVideo,
478
471
  );
479
472
  } catch (eVideo) {
480
473
  logger.debug(
@@ -491,12 +484,7 @@ export default class RtcEngine {
491
484
  videoConfig.cameraId = '';
492
485
  try {
493
486
  localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
494
- logger.log(
495
- LogSource.AgoraSDK,
496
- 'API',
497
- 'RTC video track created',
498
- localVideo,
499
- );
487
+ logger.log(LogSource.AgoraSDK, 'API', 'RTC video track created');
500
488
  } catch (error) {
501
489
  logger.debug(
502
490
  LogSource.AgoraSDK,
@@ -595,7 +583,6 @@ export default class RtcEngine {
595
583
  LogSource.AgoraSDK,
596
584
  'API',
597
585
  'RTC [publish] trying to publish tracks',
598
- tracks,
599
586
  );
600
587
  await this.client.publish(tracks);
601
588
  logger.log(
@@ -627,7 +614,6 @@ export default class RtcEngine {
627
614
  'RTC [publish] Error publish tracks failed',
628
615
  {
629
616
  error: e,
630
- stream: this.localStream,
631
617
  },
632
618
  );
633
619
  console.error(e, this.localStream);
@@ -1139,10 +1125,6 @@ export default class RtcEngine {
1139
1125
  LogSource.AgoraSDK,
1140
1126
  'API',
1141
1127
  `RTC [createClient] user and screen client with profile ${profile} created successfully`,
1142
- {
1143
- client: this.client,
1144
- screenClient: this.screenClient,
1145
- },
1146
1128
  );
1147
1129
  } catch (e) {
1148
1130
  logger.error(
@@ -1407,7 +1389,6 @@ export default class RtcEngine {
1407
1389
  'RTC [setEncryptionConfig] trying to set encryption config on user and screen client',
1408
1390
  {
1409
1391
  mode,
1410
- key: config.encryptionKey,
1411
1392
  },
1412
1393
  );
1413
1394
  await Promise.all([
@@ -1539,7 +1520,7 @@ export default class RtcEngine {
1539
1520
  logger.debug(
1540
1521
  LogSource.AgoraSDK,
1541
1522
  'Log',
1542
- 'RTC start screenshare, creating stream',
1523
+ 'RTC start screenshare, creating screen stream',
1543
1524
  );
1544
1525
  if (encryption && encryption.screenKey && encryption.mode) {
1545
1526
  let mode: EncryptionMode;
@@ -1577,7 +1558,6 @@ export default class RtcEngine {
1577
1558
  'RTC [createScreenVideoTrack] Trying to create screenshare tracks',
1578
1559
  {
1579
1560
  config,
1580
- audio,
1581
1561
  },
1582
1562
  );
1583
1563
  const screenTracks = await AgoraRTC.createScreenVideoTrack(
@@ -1634,8 +1614,7 @@ export default class RtcEngine {
1634
1614
  logger.log(
1635
1615
  LogSource.AgoraSDK,
1636
1616
  'API',
1637
- 'RTC [publish] trying to publish tracks',
1638
- this.screenStream,
1617
+ 'RTC [publish] trying to publish screen tracks',
1639
1618
  );
1640
1619
  await this.screenClient.publish(
1641
1620
  this.screenStream.audio
@@ -1646,7 +1625,6 @@ export default class RtcEngine {
1646
1625
  LogSource.AgoraSDK,
1647
1626
  'API',
1648
1627
  'RTC [publish] screenshare tracks published successfully',
1649
- this.screenStream,
1650
1628
  );
1651
1629
  this.screenStream.video.on('track-ended', () => {
1652
1630
  (this.eventsMap.get('onUserOffline') as callbackType)(
@@ -64,6 +64,12 @@ export interface VBPanelProps {
64
64
  }
65
65
 
66
66
  export type ToolbarType = React.ComponentType | Array<ToolbarCustomItem>;
67
+ export type CustomLogger = (
68
+ message: string,
69
+ data: any,
70
+ type: 'debug' | 'error' | 'info' | 'warn',
71
+ ) => void;
72
+
67
73
  export interface VideoCallInterface extends BeforeAndAfterInterface {
68
74
  // commented for v1 release
69
75
  topToolBar?: ToolbarType;
@@ -137,6 +143,10 @@ export interface CustomizationApiInterface {
137
143
  * Internationlization
138
144
  */
139
145
  i18n?: I18nInterface[];
146
+ /**
147
+ * Custom logger
148
+ */
149
+ logger?: CustomLogger;
140
150
  /**
141
151
  * Life cycle events
142
152
  */
@@ -17,6 +17,12 @@ import {initTransportLayerForCustomers} from './transports/customer-transport';
17
17
 
18
18
  const cli_version = 'test';
19
19
 
20
+ export type CustomLogger = (
21
+ message: string,
22
+ data: any,
23
+ type: StatusType,
24
+ ) => void;
25
+
20
26
  export declare const StatusTypes: {
21
27
  readonly debug: 'debug';
22
28
  readonly error: 'error';
@@ -45,6 +51,7 @@ type LogType = {
45
51
  [LogSource.Internals]:
46
52
  | 'AUTH'
47
53
  | 'CREATE_MEETING'
54
+ | 'SET_MEETING_DETAILS'
48
55
  | 'ENTER_MEETING_ROOM'
49
56
  | 'JOIN_MEETING'
50
57
  | 'PRECALL_SCREEN'
@@ -117,6 +124,7 @@ export default class AppBuilderLogger implements Logger {
117
124
  warn: LogFn;
118
125
  debug: LogFn;
119
126
  error: LogFn;
127
+ private _customLogger: CustomLogger;
120
128
 
121
129
  constructor(_transportLogger?: any) {
122
130
  const session = nanoid();
@@ -127,6 +135,11 @@ export default class AppBuilderLogger implements Logger {
127
135
  const rtcPkg = isWeb()
128
136
  ? pkg.dependencies['agora-rtc-sdk-ng']
129
137
  : pkg.dependencies['react-native-agora'];
138
+ let roomInfo = {
139
+ meetingTitle: null,
140
+ phrase: null,
141
+ roomId: null,
142
+ };
130
143
  const logger =
131
144
  (status: StatusType) =>
132
145
  <T extends LogSource>(
@@ -139,6 +152,9 @@ export default class AppBuilderLogger implements Logger {
139
152
  return;
140
153
  }
141
154
 
155
+ if (type === 'SET_MEETING_DETAILS') {
156
+ roomInfo = {...data[0]};
157
+ }
142
158
  const context = {
143
159
  timestamp: Date.now(),
144
160
  source,
@@ -154,22 +170,28 @@ export default class AppBuilderLogger implements Logger {
154
170
  rtm: rtmPkg,
155
171
  rtc: rtcPkg,
156
172
  },
173
+ ...roomInfo,
157
174
  },
158
175
  };
159
176
 
160
- if (
161
- (ENABLE_AGORA_LOGGER_TRANSPORT || ENABLE_CUSTOMER_LOGGER_TRANSPORT) &&
162
- _transportLogger
163
- ) {
164
- try {
177
+ try {
178
+ if (ENABLE_CUSTOMER_LOGGER_TRANSPORT) {
179
+ if (this._customLogger) {
180
+ this._customLogger(logMessage, context, status);
181
+ } else if (_transportLogger) {
182
+ _transportLogger(logMessage, context, status);
183
+ }
184
+ }
185
+ if (ENABLE_AGORA_LOGGER_TRANSPORT && _transportLogger) {
165
186
  _transportLogger(logMessage, context, status);
166
- } catch (error) {
167
- console.log(
168
- `error occured whhile trasnporting log for project : ${$config.PROJECT_ID}`,
169
- error,
170
- );
171
187
  }
188
+ } catch (error) {
189
+ console.log(
190
+ `error occured whhile trasnporting log for project : ${$config.PROJECT_ID}`,
191
+ error,
192
+ );
172
193
  }
194
+
173
195
  if (ENABLE_BROWSER_CONSOLE_LOGS || status === 'debug') {
174
196
  const consoleHeader = `%cApp-Builder: ${source}:[${type}] `;
175
197
  const consoleCSS = 'color: violet; font-weight: bold';
@@ -199,6 +221,17 @@ export default class AppBuilderLogger implements Logger {
199
221
  },
200
222
  );
201
223
  }
224
+
225
+ setCustomLogger = (_customLogger: CustomLogger) => {
226
+ this._customLogger = _customLogger;
227
+ _customLogger(
228
+ 'App intitialized with config.json',
229
+ {
230
+ config: configJSON,
231
+ },
232
+ 'debug',
233
+ );
234
+ };
202
235
  }
203
236
 
204
237
  let _transportLogger = null;
@@ -10,9 +10,9 @@ export const ENABLE_AGORA_LOGGER_TRANSPORT =
10
10
  // $config.LOG_ENABLED && $config.APP_ID === CONFERENCING_APP_ID && true;
11
11
 
12
12
  // Send logs to configured transport-> axiom (used for customer deployed apps)
13
- export const ENABLE_CUSTOMER_LOGGER_TRANSPORT = false;
14
- // $config.LOG_ENABLED && !isInternalApp;
13
+ export const ENABLE_CUSTOMER_LOGGER_TRANSPORT =
14
+ $config.LOG_ENABLED && !isInternalApp;
15
15
 
16
16
  // Print logs to browser console window - true in dev mode
17
- export const ENABLE_BROWSER_CONSOLE_LOGS = $config.LOG_ENABLED;
18
- // && process.env.NODE_ENV === 'development';
17
+ export const ENABLE_BROWSER_CONSOLE_LOGS =
18
+ $config.LOG_ENABLED && process.env.NODE_ENV === 'development';
@@ -63,14 +63,16 @@ export const createAxiomLogger = () => {
63
63
  let batchId = 0;
64
64
  let timeout: number | null = null;
65
65
 
66
- const sendInterval = 45000; // 45s
66
+ const sendInterval = 30000; // 30s
67
67
 
68
68
  const flush = () => {
69
69
  if (timeout !== null) {
70
70
  clearTimeout(timeout);
71
71
  timeout = null;
72
72
  }
73
- if (queue.length === 0) return;
73
+ if (queue.length === 0) {
74
+ return;
75
+ }
74
76
  sendLogs(queue);
75
77
  queue.length = 0;
76
78
  batchId = batchId + 1;
@@ -79,7 +81,7 @@ export const createAxiomLogger = () => {
79
81
  const log = (logContent: {[key: string]: any}) => {
80
82
  logContent.batchId = batchId;
81
83
  queue.push(logContent);
82
- if (queue.length >= 1000) {
84
+ if (queue.length >= 500) {
83
85
  flush();
84
86
  } else {
85
87
  if (timeout === null) {
@@ -215,6 +215,17 @@ const VideoCall: React.FC = () => {
215
215
  const {isJoinDataFetched, data, isInWaitingRoom, waitingRoomStatus} =
216
216
  useRoomInfo();
217
217
 
218
+ useEffect(() => {
219
+ if (!isJoinDataFetched) {
220
+ return;
221
+ }
222
+ logger.log(LogSource.Internals, 'SET_MEETING_DETAILS', 'Room details', {
223
+ meetingTitle: data?.meetingTitle || '',
224
+ phrase: phrase,
225
+ roomId: data?.roomId,
226
+ });
227
+ }, [isJoinDataFetched, data, phrase]);
228
+
218
229
  React.useEffect(() => {
219
230
  return () => {
220
231
  logger.debug(
@@ -365,7 +376,7 @@ const VideoCall: React.FC = () => {
365
376
  },
366
377
  UserOffline: (uid: UidType) => {
367
378
  console.log('UIKIT Callback: UserOffline', uid);
368
- SDKEvents.emit('rtc-user-joined', uid);
379
+ SDKEvents.emit('rtc-user-left', uid);
369
380
  },
370
381
  RemoteAudioStateChanged: (uid: UidType, status: 0 | 2) => {
371
382
  console.log('UIKIT Callback: RemoteAudioStateChanged', uid, status);