agora-appbuilder-core 4.0.7 → 4.0.8
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 +1 -1
- package/template/_package-lock.json +82 -0
- package/template/android/app/build.gradle +8 -0
- package/template/android/build.gradle +3 -0
- package/template/bridge/rtc/webNg/RtcEngine.ts +581 -31
- package/template/bridge/rtc/webNg/RtcSurfaceView.tsx +2 -1
- package/template/bridge/rtm/web/index.ts +2 -1
- package/template/customization-api/customize.ts +29 -10
- package/template/index.js +17 -1
- package/template/index.web.js +2 -2
- package/template/package.json +3 -0
- package/template/src/SDKAppWrapper.tsx +44 -2
- package/template/src/app-state/useNoiseSupression.native.tsx +6 -0
- package/template/src/app-state/useNoiseSupression.tsx +17 -0
- package/template/src/auth/AuthProvider.tsx +145 -8
- package/template/src/auth/IDPAuth.electron.tsx +2 -1
- package/template/src/auth/IDPAuth.tsx +8 -2
- package/template/src/auth/openIDPURL.native.tsx +14 -3
- package/template/src/auth/useTokenAuth.tsx +7 -1
- package/template/src/components/Controls.tsx +2 -1
- package/template/src/components/DeviceConfigure.tsx +67 -17
- package/template/src/components/Precall.tsx +21 -0
- package/template/src/components/RTMConfigure.tsx +188 -24
- package/template/src/components/SettingsView.tsx +2 -0
- package/template/src/components/Share.tsx +11 -0
- package/template/src/components/StorageContext.tsx +32 -2
- package/template/src/components/chat-messages/useChatMessages.tsx +65 -5
- package/template/src/components/contexts/WaitingRoomContext.tsx +5 -1
- package/template/src/components/precall/joinCallBtn.tsx +6 -0
- package/template/src/components/precall/usePreCall.tsx +18 -2
- package/template/src/components/room-info/useRoomInfo.tsx +28 -25
- package/template/src/components/useUserPreference.tsx +13 -2
- package/template/src/components/useWakeLock.tsx +18 -4
- package/template/src/components/virtual-background/VBCard.tsx +40 -1
- package/template/src/components/virtual-background/VButils.native.ts +24 -5
- package/template/src/components/virtual-background/VButils.ts +29 -5
- package/template/src/components/virtual-background/VideoPreview.tsx +11 -1
- package/template/src/components/virtual-background/useVB.native.tsx +19 -3
- package/template/src/components/whiteboard/WhiteboardConfigure.tsx +32 -5
- package/template/src/components/whiteboard/WhiteboardToolBox.tsx +38 -8
- package/template/src/components/whiteboard/WhiteboardView.native.tsx +37 -13
- package/template/src/language/useLanguage.tsx +10 -4
- package/template/src/logger/AppBuilderLogger.tsx +215 -0
- package/template/src/logger/constants.ts +18 -0
- package/template/src/logger/transports/agora-transport.native.ts +58 -0
- package/template/src/logger/transports/agora-transport.ts +28 -0
- package/template/src/logger/transports/customer-transport.ts +115 -0
- package/template/src/pages/Create.tsx +27 -2
- package/template/src/pages/Endcall.tsx +6 -1
- package/template/src/pages/Join.tsx +31 -4
- package/template/src/pages/VideoCall.tsx +20 -56
- package/template/src/pages/video-call/DefaultLayouts.ts +11 -3
- package/template/src/pages/video-call/SidePanelHeader.tsx +12 -2
- package/template/src/pages/video-call/VideoCallScreen.tsx +8 -0
- package/template/src/pages/video-call/VideoRenderer.tsx +6 -0
- package/template/src/rtm/RTMEngine.ts +5 -0
- package/template/src/rtm-events-api/Events.ts +70 -16
- package/template/src/subComponents/LayoutIconDropdown.tsx +6 -0
- package/template/src/subComponents/LocalAudioMute.tsx +13 -3
- package/template/src/subComponents/LocalEndCall.tsx +8 -3
- package/template/src/subComponents/LocalVideoMute.tsx +15 -1
- package/template/src/subComponents/SelectDevice.tsx +111 -3
- package/template/src/subComponents/caption/CaptionContainer.tsx +17 -2
- package/template/src/subComponents/caption/useSTTAPI.tsx +62 -20
- package/template/src/subComponents/caption/useTranscriptDownload.native.ts +35 -5
- package/template/src/subComponents/caption/useTranscriptDownload.ts +12 -2
- package/template/src/subComponents/chat/ChatParticipants.tsx +6 -0
- package/template/src/subComponents/recording/useRecording.tsx +102 -15
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +33 -2
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +18 -2
- package/template/src/subComponents/waiting-rooms/useWaitingRoomAPI.ts +26 -0
- package/template/src/utils/axiomLogger.ts +2 -1
- package/template/src/utils/useCreateRoom.ts +30 -0
- package/template/src/utils/useFindActiveSpeaker.ts +43 -0
- package/template/src/utils/useFocus.tsx +8 -3
- package/template/src/utils/useIsLocalUserSpeaking.ts +19 -3
- package/template/src/utils/useJoinRoom.ts +27 -0
- package/template/src/utils/useLayout.tsx +9 -3
- package/template/src/utils/useSidePanel.tsx +14 -3
|
@@ -39,6 +39,7 @@ import {role, mode, RtcEngineContext} from './Types';
|
|
|
39
39
|
import {LOG_ENABLED, GEO_FENCING} from '../../../config.json';
|
|
40
40
|
import {Platform} from 'react-native';
|
|
41
41
|
import isMobileOrTablet from '../../../src/utils/isMobileOrTablet';
|
|
42
|
+
import {LogSource, logger} from '../../../src/logger/AppBuilderLogger';
|
|
42
43
|
|
|
43
44
|
interface MediaDeviceInfo {
|
|
44
45
|
readonly deviceId: string;
|
|
@@ -248,22 +249,58 @@ export default class RtcEngine {
|
|
|
248
249
|
|
|
249
250
|
initialize(context: RtcEngineContext) {
|
|
250
251
|
const {appId} = context;
|
|
252
|
+
logger.log(LogSource.AgoraSDK, 'Log', 'RTC engine initialized');
|
|
251
253
|
this.appId = appId;
|
|
252
254
|
}
|
|
253
255
|
|
|
254
256
|
getRemoteVideoStats(id: string) {
|
|
255
257
|
try {
|
|
258
|
+
logger.log(
|
|
259
|
+
LogSource.AgoraSDK,
|
|
260
|
+
'API',
|
|
261
|
+
'RTC [getRemoteVideoStats] getting remote video stats',
|
|
262
|
+
);
|
|
256
263
|
const data = this.client.getRemoteVideoStats();
|
|
264
|
+
logger.debug(
|
|
265
|
+
LogSource.AgoraSDK,
|
|
266
|
+
'API',
|
|
267
|
+
'RTC [getRemoteVideoStats] got remote video stats successfully',
|
|
268
|
+
data,
|
|
269
|
+
);
|
|
257
270
|
return data && data[id] ? data[id] : null;
|
|
258
271
|
} catch (error) {
|
|
259
|
-
|
|
272
|
+
logger.error(
|
|
273
|
+
LogSource.AgoraSDK,
|
|
274
|
+
'API',
|
|
275
|
+
'RTC [getRemoteVideoStats] Error while getting remote video stats',
|
|
276
|
+
error,
|
|
277
|
+
);
|
|
260
278
|
return null;
|
|
261
279
|
}
|
|
262
280
|
}
|
|
263
281
|
|
|
264
282
|
async setVideoProfile(profile: VideoProfile): Promise<void> {
|
|
265
|
-
|
|
266
|
-
|
|
283
|
+
try {
|
|
284
|
+
this.videoProfile = profile;
|
|
285
|
+
logger.log(
|
|
286
|
+
LogSource.AgoraSDK,
|
|
287
|
+
'API',
|
|
288
|
+
`RTC [setEncoderConfiguration] setting video profile to - ${profile}`,
|
|
289
|
+
);
|
|
290
|
+
this.localStream?.video?.setEncoderConfiguration(profile);
|
|
291
|
+
logger.log(
|
|
292
|
+
LogSource.AgoraSDK,
|
|
293
|
+
'API',
|
|
294
|
+
`RTC [setEncoderConfiguration] set video profile to - ${profile} successfully`,
|
|
295
|
+
);
|
|
296
|
+
} catch (error) {
|
|
297
|
+
logger.error(
|
|
298
|
+
LogSource.AgoraSDK,
|
|
299
|
+
'API',
|
|
300
|
+
'RTC [setEncoderConfiguration] Error while setting video profile',
|
|
301
|
+
error,
|
|
302
|
+
);
|
|
303
|
+
}
|
|
267
304
|
}
|
|
268
305
|
|
|
269
306
|
async enableAudio(): Promise<void> {
|
|
@@ -272,13 +309,31 @@ export default class RtcEngine {
|
|
|
272
309
|
// microphoneId: this.audioDeviceId,
|
|
273
310
|
};
|
|
274
311
|
try {
|
|
312
|
+
logger.log(
|
|
313
|
+
LogSource.AgoraSDK,
|
|
314
|
+
'API',
|
|
315
|
+
'RTC [createMicrophoneAudioTrack] creating audio track',
|
|
316
|
+
audioConfig,
|
|
317
|
+
);
|
|
275
318
|
let localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
319
|
+
logger.log(
|
|
320
|
+
LogSource.AgoraSDK,
|
|
321
|
+
'API',
|
|
322
|
+
'RTC [createMicrophoneAudioTrack] created audio track successfully',
|
|
323
|
+
audioConfig,
|
|
324
|
+
);
|
|
276
325
|
this.localStream.audio = localAudio;
|
|
277
326
|
this.audioDeviceId = localAudio
|
|
278
327
|
?.getMediaStreamTrack()
|
|
279
328
|
.getSettings().deviceId;
|
|
280
329
|
this.isAudioEnabled = true;
|
|
281
330
|
} catch (e) {
|
|
331
|
+
logger.error(
|
|
332
|
+
LogSource.AgoraSDK,
|
|
333
|
+
'API',
|
|
334
|
+
'RTC [createMicrophoneAudioTrack] Error while creating audio track',
|
|
335
|
+
error,
|
|
336
|
+
);
|
|
282
337
|
let audioError = e;
|
|
283
338
|
e.status = {audioError};
|
|
284
339
|
throw e;
|
|
@@ -307,6 +362,15 @@ export default class RtcEngine {
|
|
|
307
362
|
cameraId: preferredCameraId,
|
|
308
363
|
};
|
|
309
364
|
try {
|
|
365
|
+
logger.log(
|
|
366
|
+
LogSource.AgoraSDK,
|
|
367
|
+
'API',
|
|
368
|
+
'RTC [createMicrophoneAndCameraTracks] creating audio and video tracks',
|
|
369
|
+
{
|
|
370
|
+
audioConfig,
|
|
371
|
+
videoConfig,
|
|
372
|
+
},
|
|
373
|
+
);
|
|
310
374
|
let [localAudio, localVideo] =
|
|
311
375
|
// If preferred devices are not present, the createTrack call will fallover to
|
|
312
376
|
// the catch block below.
|
|
@@ -314,6 +378,15 @@ export default class RtcEngine {
|
|
|
314
378
|
audioConfig,
|
|
315
379
|
videoConfig,
|
|
316
380
|
);
|
|
381
|
+
logger.log(
|
|
382
|
+
LogSource.AgoraSDK,
|
|
383
|
+
'API',
|
|
384
|
+
'RTC [createMicrophoneAndCameraTracks] audio and video tracks created successfully',
|
|
385
|
+
{
|
|
386
|
+
audio: localAudio,
|
|
387
|
+
video: localVideo,
|
|
388
|
+
},
|
|
389
|
+
);
|
|
317
390
|
this.localStream.audio = localAudio;
|
|
318
391
|
this.localStream.video = localVideo;
|
|
319
392
|
this.audioDeviceId = localAudio
|
|
@@ -325,16 +398,52 @@ export default class RtcEngine {
|
|
|
325
398
|
this.isVideoEnabled = true;
|
|
326
399
|
this.isAudioEnabled = true;
|
|
327
400
|
} catch (e) {
|
|
401
|
+
logger.log(
|
|
402
|
+
LogSource.AgoraSDK,
|
|
403
|
+
'API',
|
|
404
|
+
'RTC [createMicrophoneAndCameraTracks] Error while creating audio and video tracks',
|
|
405
|
+
{
|
|
406
|
+
error: e,
|
|
407
|
+
},
|
|
408
|
+
);
|
|
328
409
|
let audioError = false;
|
|
329
410
|
let videoError = false;
|
|
330
|
-
|
|
331
411
|
try {
|
|
332
412
|
let localAudio: IMicrophoneAudioTrack;
|
|
413
|
+
logger.log(
|
|
414
|
+
LogSource.AgoraSDK,
|
|
415
|
+
'API',
|
|
416
|
+
'RTC [createMicrophoneAudioTrack] creating audio track ',
|
|
417
|
+
audioConfig,
|
|
418
|
+
);
|
|
333
419
|
try {
|
|
334
420
|
localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
335
|
-
|
|
421
|
+
logger.log(
|
|
422
|
+
LogSource.AgoraSDK,
|
|
423
|
+
'API',
|
|
424
|
+
'RTC [createMicrophoneAudioTrack] audio track created',
|
|
425
|
+
localAudio,
|
|
426
|
+
);
|
|
427
|
+
} catch (eAudio) {
|
|
428
|
+
logger.log(
|
|
429
|
+
LogSource.AgoraSDK,
|
|
430
|
+
'API',
|
|
431
|
+
'RTC [createMicrophoneAudioTrack] Error while creating audio tracks',
|
|
432
|
+
eAudio,
|
|
433
|
+
);
|
|
434
|
+
logger.log(
|
|
435
|
+
LogSource.AgoraSDK,
|
|
436
|
+
'Log',
|
|
437
|
+
'RTC [createMicrophoneAudioTrack] Setting microphoneId as empty and again creating audio track',
|
|
438
|
+
);
|
|
336
439
|
videoConfig.microphoneId = '';
|
|
337
440
|
localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
441
|
+
logger.log(
|
|
442
|
+
LogSource.AgoraSDK,
|
|
443
|
+
'API',
|
|
444
|
+
'RTC [createMicrophoneAudioTrack] audio track created successfully',
|
|
445
|
+
localAudio,
|
|
446
|
+
);
|
|
338
447
|
}
|
|
339
448
|
this.localStream.audio = localAudio;
|
|
340
449
|
this.audioDeviceId = localAudio
|
|
@@ -342,22 +451,71 @@ export default class RtcEngine {
|
|
|
342
451
|
.getSettings().deviceId;
|
|
343
452
|
this.isAudioEnabled = true;
|
|
344
453
|
} catch (error) {
|
|
454
|
+
logger.error(
|
|
455
|
+
LogSource.AgoraSDK,
|
|
456
|
+
'API',
|
|
457
|
+
'RTC [createMicrophoneAudioTrack] Error while creating audio track',
|
|
458
|
+
error,
|
|
459
|
+
);
|
|
345
460
|
audioError = error;
|
|
346
461
|
}
|
|
347
462
|
|
|
348
463
|
try {
|
|
349
464
|
let localVideo: ICameraVideoTrack;
|
|
350
465
|
try {
|
|
466
|
+
logger.log(
|
|
467
|
+
LogSource.AgoraSDK,
|
|
468
|
+
'API',
|
|
469
|
+
'RTC [createCameraVideoTrack] creating video track',
|
|
470
|
+
videoConfig,
|
|
471
|
+
);
|
|
351
472
|
localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
|
|
352
|
-
|
|
473
|
+
logger.log(
|
|
474
|
+
LogSource.AgoraSDK,
|
|
475
|
+
'API',
|
|
476
|
+
'RTC [createCameraVideoTrack] video track created successfully',
|
|
477
|
+
localVideo,
|
|
478
|
+
);
|
|
479
|
+
} catch (eVideo) {
|
|
480
|
+
logger.debug(
|
|
481
|
+
LogSource.AgoraSDK,
|
|
482
|
+
'API',
|
|
483
|
+
'RTC [createCameraVideoTrack] Error while creating video tracks',
|
|
484
|
+
eVideo,
|
|
485
|
+
);
|
|
486
|
+
logger.log(
|
|
487
|
+
LogSource.AgoraSDK,
|
|
488
|
+
'Log',
|
|
489
|
+
'RTC [createCameraVideoTrack] Setting cameraId as empty and again creating video track',
|
|
490
|
+
);
|
|
353
491
|
videoConfig.cameraId = '';
|
|
354
492
|
try {
|
|
355
493
|
localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
'
|
|
494
|
+
logger.log(
|
|
495
|
+
LogSource.AgoraSDK,
|
|
496
|
+
'API',
|
|
497
|
+
'RTC video track created',
|
|
498
|
+
localVideo,
|
|
499
|
+
);
|
|
500
|
+
} catch (error) {
|
|
501
|
+
logger.debug(
|
|
502
|
+
LogSource.AgoraSDK,
|
|
503
|
+
'API',
|
|
504
|
+
'RTC [createCameraVideoTrack] Error while creating video track',
|
|
505
|
+
error,
|
|
506
|
+
);
|
|
507
|
+
logger.log(
|
|
508
|
+
LogSource.AgoraSDK,
|
|
509
|
+
'Log',
|
|
510
|
+
'RTC [RTCEngineBridge]: Provided cameraId and default camera failed, Trying other available devices',
|
|
359
511
|
);
|
|
360
512
|
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
513
|
+
logger.log(
|
|
514
|
+
LogSource.AgoraSDK,
|
|
515
|
+
'Log',
|
|
516
|
+
'RTC [enumerateDevices] media devices available',
|
|
517
|
+
devices,
|
|
518
|
+
);
|
|
361
519
|
for (let device of devices) {
|
|
362
520
|
if (device.kind === 'videoinput') {
|
|
363
521
|
videoConfig.cameraId = device.deviceId;
|
|
@@ -366,13 +524,16 @@ export default class RtcEngine {
|
|
|
366
524
|
videoConfig,
|
|
367
525
|
);
|
|
368
526
|
break;
|
|
369
|
-
} catch (
|
|
370
|
-
videoError =
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
'
|
|
374
|
-
'
|
|
375
|
-
|
|
527
|
+
} catch (eVideoDevice) {
|
|
528
|
+
videoError = eVideoDevice;
|
|
529
|
+
logger.log(
|
|
530
|
+
LogSource.AgoraSDK,
|
|
531
|
+
'Log',
|
|
532
|
+
'RTC Camera not available with deviceId',
|
|
533
|
+
{
|
|
534
|
+
device,
|
|
535
|
+
reason: eVideoDevice,
|
|
536
|
+
},
|
|
376
537
|
);
|
|
377
538
|
}
|
|
378
539
|
}
|
|
@@ -385,9 +546,14 @@ export default class RtcEngine {
|
|
|
385
546
|
.getSettings().deviceId;
|
|
386
547
|
this.isVideoEnabled = true;
|
|
387
548
|
} catch (error) {
|
|
549
|
+
logger.error(
|
|
550
|
+
LogSource.AgoraSDK,
|
|
551
|
+
'API',
|
|
552
|
+
'RTC [createCameraVideoTrack] Error while creating video track',
|
|
553
|
+
error,
|
|
554
|
+
);
|
|
388
555
|
videoError = error;
|
|
389
556
|
}
|
|
390
|
-
|
|
391
557
|
e.status = {audioError, videoError};
|
|
392
558
|
throw e;
|
|
393
559
|
// if (audioError && videoError) throw e;
|
|
@@ -400,7 +566,17 @@ export default class RtcEngine {
|
|
|
400
566
|
|
|
401
567
|
async enableAudioVolumeIndication(interval, smooth, isLocal) {
|
|
402
568
|
AgoraRTC.setParameter('AUDIO_VOLUME_INDICATION_INTERVAL', interval);
|
|
569
|
+
logger.log(
|
|
570
|
+
LogSource.AgoraSDK,
|
|
571
|
+
'API',
|
|
572
|
+
`RTC [setParameter] parameter AUDIO_VOLUME_INDICATION_INTERVAL set to interval ${interval}`,
|
|
573
|
+
);
|
|
403
574
|
this.client.enableAudioVolumeIndicator();
|
|
575
|
+
logger.log(
|
|
576
|
+
LogSource.AgoraSDK,
|
|
577
|
+
'API',
|
|
578
|
+
'RTC [enableAudioVolumeIndicator] enabled to report the local and remote users who are speaking and their volumes',
|
|
579
|
+
);
|
|
404
580
|
}
|
|
405
581
|
|
|
406
582
|
async publish() {
|
|
@@ -415,7 +591,18 @@ export default class RtcEngine {
|
|
|
415
591
|
tracks.push(this.localStream.video);
|
|
416
592
|
|
|
417
593
|
if (tracks.length > 0) {
|
|
594
|
+
logger.log(
|
|
595
|
+
LogSource.AgoraSDK,
|
|
596
|
+
'API',
|
|
597
|
+
'RTC [publish] trying to publish tracks',
|
|
598
|
+
tracks,
|
|
599
|
+
);
|
|
418
600
|
await this.client.publish(tracks);
|
|
601
|
+
logger.log(
|
|
602
|
+
LogSource.AgoraSDK,
|
|
603
|
+
'API',
|
|
604
|
+
'RTC [publish] tracks done successfully',
|
|
605
|
+
);
|
|
419
606
|
if (tracks[0].trackMediaType === 'audio') {
|
|
420
607
|
this.isAudioPublished = true;
|
|
421
608
|
} else if (tracks[0].trackMediaType === 'video') {
|
|
@@ -434,6 +621,15 @@ export default class RtcEngine {
|
|
|
434
621
|
}
|
|
435
622
|
}
|
|
436
623
|
} catch (e) {
|
|
624
|
+
logger.error(
|
|
625
|
+
LogSource.AgoraSDK,
|
|
626
|
+
'API',
|
|
627
|
+
'RTC [publish] Error publish tracks failed',
|
|
628
|
+
{
|
|
629
|
+
error: e,
|
|
630
|
+
stream: this.localStream,
|
|
631
|
+
},
|
|
632
|
+
);
|
|
437
633
|
console.error(e, this.localStream);
|
|
438
634
|
this.isPublished = false;
|
|
439
635
|
}
|
|
@@ -448,6 +644,7 @@ export default class RtcEngine {
|
|
|
448
644
|
): Promise<void> {
|
|
449
645
|
// TODO create agora client here
|
|
450
646
|
this.client.on('user-joined', user => {
|
|
647
|
+
logger.log(LogSource.AgoraSDK, 'Event', 'RTC [user-joined]', user);
|
|
451
648
|
(this.eventsMap.get('onUserJoined') as callbackType)({}, user.uid);
|
|
452
649
|
(this.eventsMap.get('onRemoteVideoStateChanged') as callbackType)(
|
|
453
650
|
{},
|
|
@@ -466,6 +663,7 @@ export default class RtcEngine {
|
|
|
466
663
|
});
|
|
467
664
|
|
|
468
665
|
this.client.on('user-left', user => {
|
|
666
|
+
logger.log(LogSource.AgoraSDK, 'Event', 'RTC [user-left]', user);
|
|
469
667
|
const uid = user.uid;
|
|
470
668
|
if (this.remoteStreams.has(uid)) {
|
|
471
669
|
this.remoteStreams.delete(uid);
|
|
@@ -475,6 +673,13 @@ export default class RtcEngine {
|
|
|
475
673
|
});
|
|
476
674
|
this.client.on('user-published', async (user, mediaType) => {
|
|
477
675
|
// Initiate the subscription
|
|
676
|
+
logger.log(
|
|
677
|
+
LogSource.AgoraSDK,
|
|
678
|
+
'Event',
|
|
679
|
+
'RTC [user-published]',
|
|
680
|
+
user,
|
|
681
|
+
mediaType,
|
|
682
|
+
);
|
|
478
683
|
if (this.inScreenshare && user.uid === this.screenClient.uid) {
|
|
479
684
|
(this.eventsMap.get('onRemoteVideoStateChanged') as callbackType)(
|
|
480
685
|
{},
|
|
@@ -485,6 +690,13 @@ export default class RtcEngine {
|
|
|
485
690
|
);
|
|
486
691
|
} else {
|
|
487
692
|
await this.client.subscribe(user, mediaType);
|
|
693
|
+
logger.log(
|
|
694
|
+
LogSource.AgoraSDK,
|
|
695
|
+
'API',
|
|
696
|
+
'RTC [subscribe] to track successfully done',
|
|
697
|
+
user,
|
|
698
|
+
mediaType,
|
|
699
|
+
);
|
|
488
700
|
}
|
|
489
701
|
// If the subscribed track is an audio track
|
|
490
702
|
if (mediaType === 'audio') {
|
|
@@ -526,6 +738,13 @@ export default class RtcEngine {
|
|
|
526
738
|
}
|
|
527
739
|
});
|
|
528
740
|
this.client.on('user-unpublished', async (user, mediaType) => {
|
|
741
|
+
logger.log(
|
|
742
|
+
LogSource.AgoraSDK,
|
|
743
|
+
'Event',
|
|
744
|
+
'RTC [user-unpublished]',
|
|
745
|
+
user,
|
|
746
|
+
mediaType,
|
|
747
|
+
);
|
|
529
748
|
if (mediaType === 'audio') {
|
|
530
749
|
const {audio, ...rest} = this.remoteStreams.get(user.uid);
|
|
531
750
|
this.remoteStreams.set(user.uid, rest);
|
|
@@ -585,7 +804,13 @@ export default class RtcEngine {
|
|
|
585
804
|
|
|
586
805
|
// this.client.on('stream-fallback', (evt))
|
|
587
806
|
this.client.on('stream-type-changed', function (uid, streamType) {
|
|
588
|
-
|
|
807
|
+
logger.debug(
|
|
808
|
+
LogSource.AgoraSDK,
|
|
809
|
+
'Event',
|
|
810
|
+
'RTC [stream-type-changed]',
|
|
811
|
+
uid,
|
|
812
|
+
streamType,
|
|
813
|
+
);
|
|
589
814
|
});
|
|
590
815
|
|
|
591
816
|
this.client.on(
|
|
@@ -618,20 +843,40 @@ export default class RtcEngine {
|
|
|
618
843
|
|
|
619
844
|
/* Recieve Captions */
|
|
620
845
|
this.client.on('stream-message', (uid: UID, payload: UInt8Array) => {
|
|
621
|
-
|
|
622
|
-
|
|
846
|
+
logger.debug(
|
|
847
|
+
LogSource.AgoraSDK,
|
|
848
|
+
'Event',
|
|
849
|
+
'RTC [stream-message](stt-web: onStreamMessageCallback)',
|
|
850
|
+
uid,
|
|
851
|
+
payload,
|
|
623
852
|
);
|
|
624
853
|
(this.eventsMap.get('onStreamMessage') as callbackType)(uid, payload);
|
|
625
854
|
});
|
|
626
855
|
|
|
856
|
+
logger.log(LogSource.AgoraSDK, 'API', 'RTC [join] trying to join channel', {
|
|
857
|
+
appId: this.appId,
|
|
858
|
+
channelName,
|
|
859
|
+
token,
|
|
860
|
+
optionalUid,
|
|
861
|
+
});
|
|
627
862
|
await this.client.join(
|
|
628
863
|
this.appId,
|
|
629
864
|
channelName,
|
|
630
865
|
token || null,
|
|
631
866
|
optionalUid || null,
|
|
632
867
|
);
|
|
868
|
+
logger.log(
|
|
869
|
+
LogSource.AgoraSDK,
|
|
870
|
+
'API',
|
|
871
|
+
'RTC [join] channel joined successfully',
|
|
872
|
+
);
|
|
633
873
|
this.isJoined = true;
|
|
634
874
|
|
|
875
|
+
logger.log(
|
|
876
|
+
LogSource.AgoraSDK,
|
|
877
|
+
'Log',
|
|
878
|
+
'RTC [publish] start publishing in the channel',
|
|
879
|
+
);
|
|
635
880
|
await this.publish();
|
|
636
881
|
console.log('enabling screen sleep');
|
|
637
882
|
}
|
|
@@ -642,11 +887,21 @@ export default class RtcEngine {
|
|
|
642
887
|
|
|
643
888
|
async leaveChannel(): Promise<void> {
|
|
644
889
|
this.client.leave();
|
|
890
|
+
logger.log(
|
|
891
|
+
LogSource.AgoraSDK,
|
|
892
|
+
'API',
|
|
893
|
+
'RTC [leave] client has left the channel successfully',
|
|
894
|
+
);
|
|
645
895
|
this.remoteStreams.forEach((stream, uid, map) => {
|
|
646
896
|
stream.video?.close();
|
|
647
897
|
stream.audio?.close();
|
|
648
898
|
});
|
|
649
899
|
this.remoteStreams.clear();
|
|
900
|
+
logger.log(
|
|
901
|
+
LogSource.AgoraSDK,
|
|
902
|
+
'Log',
|
|
903
|
+
'RTC closed all remote streams successfully',
|
|
904
|
+
);
|
|
650
905
|
console.log('disabling screen sleep');
|
|
651
906
|
}
|
|
652
907
|
|
|
@@ -689,12 +944,34 @@ export default class RtcEngine {
|
|
|
689
944
|
* The camera light stays on for video
|
|
690
945
|
* It takes less time for the audio or video to resume.
|
|
691
946
|
*/
|
|
947
|
+
logger.log(
|
|
948
|
+
LogSource.AgoraSDK,
|
|
949
|
+
'Log',
|
|
950
|
+
`RTC [setMuted] trying to ${
|
|
951
|
+
muted ? 'mute' : 'unmute'
|
|
952
|
+
} local audio stream`,
|
|
953
|
+
);
|
|
954
|
+
logger.log(
|
|
955
|
+
LogSource.AgoraSDK,
|
|
956
|
+
'API',
|
|
957
|
+
`RTC [setMuted] on audio track with value - ${muted}`,
|
|
958
|
+
);
|
|
692
959
|
await this.localStream.audio?.setMuted(muted);
|
|
960
|
+
logger.log(
|
|
961
|
+
LogSource.AgoraSDK,
|
|
962
|
+
'API',
|
|
963
|
+
'RTC [setMuted] on audio track successfully done',
|
|
964
|
+
);
|
|
693
965
|
// Release the lock once done
|
|
694
966
|
this.muteLocalAudioMutex = false;
|
|
695
967
|
this.isAudioEnabled = !muted;
|
|
696
968
|
// Unpublish only after when the user has joined the call
|
|
697
969
|
if (!muted && !this.isAudioPublished && this.isJoined) {
|
|
970
|
+
logger.log(
|
|
971
|
+
LogSource.AgoraSDK,
|
|
972
|
+
'Log',
|
|
973
|
+
'RTC [publish] trying to publish audio track',
|
|
974
|
+
);
|
|
698
975
|
await this.publish();
|
|
699
976
|
}
|
|
700
977
|
}
|
|
@@ -702,9 +979,11 @@ export default class RtcEngine {
|
|
|
702
979
|
if (didProcureMutexLock) {
|
|
703
980
|
this.muteLocalAudioMutex = false;
|
|
704
981
|
}
|
|
705
|
-
|
|
982
|
+
logger.error(
|
|
983
|
+
LogSource.AgoraSDK,
|
|
984
|
+
'Log',
|
|
985
|
+
'RTC [setMuted] Error Be sure to invoke the enableVideo method before calling setMuted method.',
|
|
706
986
|
e,
|
|
707
|
-
'\n Be sure to invoke the enableVideo method before using this method.',
|
|
708
987
|
);
|
|
709
988
|
}
|
|
710
989
|
}
|
|
@@ -721,13 +1000,35 @@ export default class RtcEngine {
|
|
|
721
1000
|
* The indicator light of the camera turns off and stays off.
|
|
722
1001
|
* It takes more time for the audio or video to resume.
|
|
723
1002
|
*/
|
|
1003
|
+
logger.log(
|
|
1004
|
+
LogSource.AgoraSDK,
|
|
1005
|
+
'Log',
|
|
1006
|
+
`RTC [setEnabled] trying to ${
|
|
1007
|
+
muted ? 'mute' : 'unmute'
|
|
1008
|
+
} local video stream`,
|
|
1009
|
+
);
|
|
1010
|
+
logger.log(
|
|
1011
|
+
LogSource.AgoraSDK,
|
|
1012
|
+
'API',
|
|
1013
|
+
`RTC [setEnabled] on video track with value - ${!muted}`,
|
|
1014
|
+
);
|
|
724
1015
|
await this.localStream.video?.setEnabled(!muted);
|
|
1016
|
+
logger.log(
|
|
1017
|
+
LogSource.AgoraSDK,
|
|
1018
|
+
'API',
|
|
1019
|
+
'RTC [setEnabled] on video track done successfully',
|
|
1020
|
+
);
|
|
725
1021
|
// Release the lock once done
|
|
726
1022
|
this.muteLocalVideoMutex = false;
|
|
727
1023
|
|
|
728
1024
|
this.isVideoEnabled = !muted;
|
|
729
1025
|
// Unpublish only after when the user has joined the call
|
|
730
1026
|
if (!muted && !this.isVideoPublished && this.isJoined) {
|
|
1027
|
+
logger.log(
|
|
1028
|
+
LogSource.AgoraSDK,
|
|
1029
|
+
'Log',
|
|
1030
|
+
'RTC [publish] publish video track',
|
|
1031
|
+
);
|
|
731
1032
|
await this.publish();
|
|
732
1033
|
}
|
|
733
1034
|
}
|
|
@@ -737,25 +1038,70 @@ export default class RtcEngine {
|
|
|
737
1038
|
if (didProcureMutexLock) {
|
|
738
1039
|
this.muteLocalVideoMutex = false;
|
|
739
1040
|
}
|
|
740
|
-
|
|
1041
|
+
logger.error(
|
|
1042
|
+
LogSource.AgoraSDK,
|
|
1043
|
+
'Log',
|
|
1044
|
+
'RTC [setEnabled] Error Be sure to invoke the enableVideo method before calling setEnabled method.',
|
|
741
1045
|
e,
|
|
742
|
-
'\n Be sure to invoke the enableVideo method before using this method.',
|
|
743
1046
|
);
|
|
744
1047
|
}
|
|
745
1048
|
}
|
|
746
1049
|
|
|
747
1050
|
async muteRemoteAudioStream(uid: number, muted: boolean): Promise<void> {
|
|
748
1051
|
try {
|
|
1052
|
+
logger.log(
|
|
1053
|
+
LogSource.AgoraSDK,
|
|
1054
|
+
'API',
|
|
1055
|
+
`RTC [setEnabled] trying to ${
|
|
1056
|
+
muted ? 'mute' : 'unmute'
|
|
1057
|
+
} remote audio stream of user ${uid}`,
|
|
1058
|
+
);
|
|
749
1059
|
this.remoteStreams.get(uid)?.audio?.setEnabled(!muted);
|
|
1060
|
+
logger.log(
|
|
1061
|
+
LogSource.AgoraSDK,
|
|
1062
|
+
'API',
|
|
1063
|
+
`RTC [setEnabled] ${
|
|
1064
|
+
muted ? 'muted' : 'unmuted'
|
|
1065
|
+
} remote audio stream of user ${uid} done successfully`,
|
|
1066
|
+
);
|
|
750
1067
|
} catch (e) {
|
|
751
|
-
|
|
1068
|
+
logger.error(
|
|
1069
|
+
LogSource.AgoraSDK,
|
|
1070
|
+
'API',
|
|
1071
|
+
`RTC [setEnabled] Error: while ${
|
|
1072
|
+
muted ? 'muting' : 'unmuting'
|
|
1073
|
+
} remote audio stream of user ${uid}`,
|
|
1074
|
+
e,
|
|
1075
|
+
);
|
|
752
1076
|
}
|
|
753
1077
|
}
|
|
754
1078
|
|
|
755
1079
|
async muteRemoteVideoStream(uid: number, muted: boolean): Promise<void> {
|
|
756
1080
|
try {
|
|
1081
|
+
logger.log(
|
|
1082
|
+
LogSource.AgoraSDK,
|
|
1083
|
+
'API',
|
|
1084
|
+
`RTC [setEnabled] trying to ${
|
|
1085
|
+
muted ? 'mute' : 'unmute'
|
|
1086
|
+
} remote video stream of user ${uid}`,
|
|
1087
|
+
);
|
|
757
1088
|
this.remoteStreams.get(uid)?.video?.setEnabled(!muted);
|
|
1089
|
+
logger.log(
|
|
1090
|
+
LogSource.AgoraSDK,
|
|
1091
|
+
'API',
|
|
1092
|
+
`RTC [setEnabled] ${
|
|
1093
|
+
muted ? 'muted' : 'unmuted'
|
|
1094
|
+
} remote video stream of user ${uid} successfully`,
|
|
1095
|
+
);
|
|
758
1096
|
} catch (e) {
|
|
1097
|
+
logger.error(
|
|
1098
|
+
LogSource.AgoraSDK,
|
|
1099
|
+
'API',
|
|
1100
|
+
`RTC [setEnabled] Error while ${
|
|
1101
|
+
muted ? 'muting' : 'unmuting'
|
|
1102
|
+
} remote video stream of user ${uid}`,
|
|
1103
|
+
e,
|
|
1104
|
+
);
|
|
759
1105
|
console.error(e);
|
|
760
1106
|
}
|
|
761
1107
|
}
|
|
@@ -770,6 +1116,11 @@ export default class RtcEngine {
|
|
|
770
1116
|
|
|
771
1117
|
async setChannelProfile(profile: ChannelProfileType): Promise<void> {
|
|
772
1118
|
try {
|
|
1119
|
+
logger.log(
|
|
1120
|
+
LogSource.AgoraSDK,
|
|
1121
|
+
'API',
|
|
1122
|
+
`RTC [createClient] creating user and screen client with profile ${profile}`,
|
|
1123
|
+
);
|
|
773
1124
|
this.client = AgoraRTC.createClient({
|
|
774
1125
|
codec: 'vp9',
|
|
775
1126
|
mode:
|
|
@@ -784,7 +1135,22 @@ export default class RtcEngine {
|
|
|
784
1135
|
? mode.live
|
|
785
1136
|
: mode.rtc,
|
|
786
1137
|
});
|
|
1138
|
+
logger.log(
|
|
1139
|
+
LogSource.AgoraSDK,
|
|
1140
|
+
'API',
|
|
1141
|
+
`RTC [createClient] user and screen client with profile ${profile} created successfully`,
|
|
1142
|
+
{
|
|
1143
|
+
client: this.client,
|
|
1144
|
+
screenClient: this.screenClient,
|
|
1145
|
+
},
|
|
1146
|
+
);
|
|
787
1147
|
} catch (e) {
|
|
1148
|
+
logger.error(
|
|
1149
|
+
LogSource.AgoraSDK,
|
|
1150
|
+
'API',
|
|
1151
|
+
`RTC [createClient] Error while creating user and screen client with profile ${profile}`,
|
|
1152
|
+
e,
|
|
1153
|
+
);
|
|
788
1154
|
throw e;
|
|
789
1155
|
}
|
|
790
1156
|
}
|
|
@@ -794,10 +1160,34 @@ export default class RtcEngine {
|
|
|
794
1160
|
options?: ClientRoleOptions,
|
|
795
1161
|
): Promise<void> {
|
|
796
1162
|
try {
|
|
1163
|
+
logger.log(
|
|
1164
|
+
LogSource.AgoraSDK,
|
|
1165
|
+
'API',
|
|
1166
|
+
`RTC [setClientRole] for user and screen client with role ${
|
|
1167
|
+
clientRole == ClientRoleType.ClientRoleAudience
|
|
1168
|
+
? 'audience'
|
|
1169
|
+
: 'broadcaster'
|
|
1170
|
+
}`,
|
|
1171
|
+
);
|
|
797
1172
|
if (clientRole == ClientRoleType.ClientRoleAudience) {
|
|
798
1173
|
if (this.isJoined) {
|
|
799
1174
|
// Unpublish the streams when role is changed to Audience
|
|
1175
|
+
logger.log(
|
|
1176
|
+
LogSource.AgoraSDK,
|
|
1177
|
+
'Log',
|
|
1178
|
+
'RTC user is already joined, and role is to be changed to audience so we need to unpublish the streams',
|
|
1179
|
+
);
|
|
1180
|
+
logger.log(
|
|
1181
|
+
LogSource.AgoraSDK,
|
|
1182
|
+
'API',
|
|
1183
|
+
'RTC [unpublish] unpublish in the channel',
|
|
1184
|
+
);
|
|
800
1185
|
await this.client.unpublish();
|
|
1186
|
+
logger.log(
|
|
1187
|
+
LogSource.AgoraSDK,
|
|
1188
|
+
'API',
|
|
1189
|
+
'RTC [unpublish] unpublish in the channel done successfully',
|
|
1190
|
+
);
|
|
801
1191
|
this.isAudioPublished = false;
|
|
802
1192
|
this.isVideoPublished = false;
|
|
803
1193
|
this.isPublished = false;
|
|
@@ -808,43 +1198,115 @@ export default class RtcEngine {
|
|
|
808
1198
|
await this.client.setClientRole(role.host);
|
|
809
1199
|
await this.screenClient.setClientRole(role.host);
|
|
810
1200
|
}
|
|
1201
|
+
logger.log(
|
|
1202
|
+
LogSource.AgoraSDK,
|
|
1203
|
+
'API',
|
|
1204
|
+
`RTC [setClientRole] for user and screen client with role ${
|
|
1205
|
+
clientRole == ClientRoleType.ClientRoleAudience
|
|
1206
|
+
? 'audience'
|
|
1207
|
+
: 'broadcaster'
|
|
1208
|
+
} done successfully`,
|
|
1209
|
+
);
|
|
811
1210
|
} catch (e) {
|
|
1211
|
+
logger.error(
|
|
1212
|
+
LogSource.AgoraSDK,
|
|
1213
|
+
'API',
|
|
1214
|
+
`RTC [setClientRole] Error while doing setClientRole for user and screen client with role ${
|
|
1215
|
+
clientRole == ClientRoleType.ClientRoleAudience
|
|
1216
|
+
? 'audience'
|
|
1217
|
+
: 'broadcaster'
|
|
1218
|
+
}`,
|
|
1219
|
+
e,
|
|
1220
|
+
);
|
|
812
1221
|
throw e;
|
|
813
1222
|
}
|
|
814
1223
|
}
|
|
815
1224
|
|
|
816
1225
|
async changeCamera(cameraId, callback, error): Promise<void> {
|
|
817
1226
|
try {
|
|
1227
|
+
logger.log(
|
|
1228
|
+
LogSource.AgoraSDK,
|
|
1229
|
+
'API',
|
|
1230
|
+
`RTC [setDevice] trying to change camera to ${cameraId}`,
|
|
1231
|
+
);
|
|
818
1232
|
await this.localStream.video?.setDevice(cameraId);
|
|
1233
|
+
logger.log(
|
|
1234
|
+
LogSource.AgoraSDK,
|
|
1235
|
+
'API',
|
|
1236
|
+
'RTC [setDevice] camera set done successfully',
|
|
1237
|
+
);
|
|
819
1238
|
this.videoDeviceId = cameraId;
|
|
820
1239
|
callback(cameraId);
|
|
821
1240
|
} catch (e) {
|
|
1241
|
+
logger.error(
|
|
1242
|
+
LogSource.AgoraSDK,
|
|
1243
|
+
'API',
|
|
1244
|
+
'RTC [setDevice] Error setting camera',
|
|
1245
|
+
e,
|
|
1246
|
+
);
|
|
822
1247
|
error(e);
|
|
823
1248
|
}
|
|
824
1249
|
}
|
|
825
1250
|
|
|
826
1251
|
async switchCamera(): Promise<void> {
|
|
827
1252
|
try {
|
|
1253
|
+
logger.log(
|
|
1254
|
+
LogSource.AgoraSDK,
|
|
1255
|
+
'Log',
|
|
1256
|
+
'RTC switching camera on mobile web',
|
|
1257
|
+
);
|
|
828
1258
|
const devices = await AgoraRTC.getDevices(true);
|
|
829
1259
|
for (let i = 0; i < devices.length; i++) {
|
|
830
1260
|
let d = devices[i];
|
|
831
1261
|
if (d.kind === 'videoinput' && d.deviceId !== this.videoDeviceId) {
|
|
1262
|
+
logger.log(
|
|
1263
|
+
LogSource.AgoraSDK,
|
|
1264
|
+
'API',
|
|
1265
|
+
`RTC [setDevice]: trying to change camera to ${d.deviceId}`,
|
|
1266
|
+
);
|
|
832
1267
|
await this.localStream.video?.setDevice(d.deviceId);
|
|
1268
|
+
logger.log(
|
|
1269
|
+
LogSource.AgoraSDK,
|
|
1270
|
+
'API',
|
|
1271
|
+
'RTC [setDevice]: camera set successfully',
|
|
1272
|
+
);
|
|
833
1273
|
this.videoDeviceId = d.deviceId;
|
|
834
1274
|
break;
|
|
835
1275
|
}
|
|
836
1276
|
}
|
|
837
1277
|
} catch (e) {
|
|
1278
|
+
logger.error(
|
|
1279
|
+
LogSource.AgoraSDK,
|
|
1280
|
+
'Log',
|
|
1281
|
+
'RTC Error switching camera on mobile web',
|
|
1282
|
+
e,
|
|
1283
|
+
);
|
|
838
1284
|
throw e;
|
|
839
1285
|
}
|
|
840
1286
|
}
|
|
841
1287
|
|
|
842
1288
|
async changeMic(micId, callback, error) {
|
|
843
1289
|
try {
|
|
1290
|
+
logger.log(
|
|
1291
|
+
LogSource.AgoraSDK,
|
|
1292
|
+
'API',
|
|
1293
|
+
`RTC [setDevice]: trying to change microphone to ${micId}`,
|
|
1294
|
+
);
|
|
844
1295
|
await this.localStream.audio?.setDevice(micId);
|
|
1296
|
+
logger.log(
|
|
1297
|
+
LogSource.AgoraSDK,
|
|
1298
|
+
'API',
|
|
1299
|
+
'RTC [setDevice]: microphone set successfully',
|
|
1300
|
+
);
|
|
845
1301
|
this.audioDeviceId = micId;
|
|
846
1302
|
callback(micId);
|
|
847
1303
|
} catch (e) {
|
|
1304
|
+
logger.error(
|
|
1305
|
+
LogSource.AgoraSDK,
|
|
1306
|
+
'API',
|
|
1307
|
+
'RTC [setDevice]: Error setting microphone',
|
|
1308
|
+
e,
|
|
1309
|
+
);
|
|
848
1310
|
error(e);
|
|
849
1311
|
}
|
|
850
1312
|
}
|
|
@@ -939,6 +1401,15 @@ export default class RtcEngine {
|
|
|
939
1401
|
let mode: EncryptionMode;
|
|
940
1402
|
mode = this.getEncryptionMode(enabled, config?.encryptionMode);
|
|
941
1403
|
try {
|
|
1404
|
+
logger.log(
|
|
1405
|
+
LogSource.AgoraSDK,
|
|
1406
|
+
'API',
|
|
1407
|
+
'RTC [setEncryptionConfig] trying to set encryption config on user and screen client',
|
|
1408
|
+
{
|
|
1409
|
+
mode,
|
|
1410
|
+
key: config.encryptionKey,
|
|
1411
|
+
},
|
|
1412
|
+
);
|
|
942
1413
|
await Promise.all([
|
|
943
1414
|
this.client.setEncryptionConfig(
|
|
944
1415
|
mode,
|
|
@@ -953,7 +1424,20 @@ export default class RtcEngine {
|
|
|
953
1424
|
true, // encryptDataStream
|
|
954
1425
|
),
|
|
955
1426
|
]);
|
|
1427
|
+
logger.log(
|
|
1428
|
+
LogSource.AgoraSDK,
|
|
1429
|
+
'API',
|
|
1430
|
+
'RTC [setEncryptionConfig] set encryption config on user and screen client done successfully',
|
|
1431
|
+
);
|
|
956
1432
|
} catch (e) {
|
|
1433
|
+
logger.log(
|
|
1434
|
+
LogSource.AgoraSDK,
|
|
1435
|
+
'API',
|
|
1436
|
+
'RTC [setEncryptionConfig] Error while setting encryption config on user and screen client',
|
|
1437
|
+
{
|
|
1438
|
+
error: e,
|
|
1439
|
+
},
|
|
1440
|
+
);
|
|
957
1441
|
throw e;
|
|
958
1442
|
}
|
|
959
1443
|
}
|
|
@@ -1008,6 +1492,11 @@ export default class RtcEngine {
|
|
|
1008
1492
|
this.screenStream.audio?.close();
|
|
1009
1493
|
this.screenStream.video?.close();
|
|
1010
1494
|
this.screenStream = {};
|
|
1495
|
+
logger.log(
|
|
1496
|
+
LogSource.AgoraSDK,
|
|
1497
|
+
'Log',
|
|
1498
|
+
'RTC destroy called. Clearing all events and closing all streams',
|
|
1499
|
+
);
|
|
1011
1500
|
}
|
|
1012
1501
|
|
|
1013
1502
|
async setRemoteVideoStreamType(
|
|
@@ -1047,8 +1536,11 @@ export default class RtcEngine {
|
|
|
1047
1536
|
): Promise<void> {
|
|
1048
1537
|
if (!this.inScreenshare) {
|
|
1049
1538
|
try {
|
|
1050
|
-
|
|
1051
|
-
|
|
1539
|
+
logger.debug(
|
|
1540
|
+
LogSource.AgoraSDK,
|
|
1541
|
+
'Log',
|
|
1542
|
+
'RTC start screenshare, creating stream',
|
|
1543
|
+
);
|
|
1052
1544
|
if (encryption && encryption.screenKey && encryption.mode) {
|
|
1053
1545
|
let mode: EncryptionMode;
|
|
1054
1546
|
mode = this.getEncryptionMode(true, encryption?.mode);
|
|
@@ -1058,6 +1550,11 @@ export default class RtcEngine {
|
|
|
1058
1550
|
* and joins again the encryption needs to be
|
|
1059
1551
|
* set again
|
|
1060
1552
|
*/
|
|
1553
|
+
logger.log(
|
|
1554
|
+
LogSource.AgoraSDK,
|
|
1555
|
+
'Log',
|
|
1556
|
+
'RTC [setEncryptionConfig] setting encryption again on screen client',
|
|
1557
|
+
);
|
|
1061
1558
|
await this.screenClient.setEncryptionConfig(
|
|
1062
1559
|
mode,
|
|
1063
1560
|
encryption.screenKey,
|
|
@@ -1065,14 +1562,36 @@ export default class RtcEngine {
|
|
|
1065
1562
|
true, // encryptDataStream
|
|
1066
1563
|
);
|
|
1067
1564
|
} catch (e) {
|
|
1068
|
-
|
|
1565
|
+
logger.error(
|
|
1566
|
+
LogSource.AgoraSDK,
|
|
1567
|
+
'Log',
|
|
1568
|
+
'RTC [setEncryptionConfig] Error setting encryption for screenshare failed',
|
|
1569
|
+
e,
|
|
1570
|
+
);
|
|
1069
1571
|
}
|
|
1070
1572
|
}
|
|
1071
1573
|
|
|
1574
|
+
logger.log(
|
|
1575
|
+
LogSource.AgoraSDK,
|
|
1576
|
+
'API',
|
|
1577
|
+
'RTC [createScreenVideoTrack] Trying to create screenshare tracks',
|
|
1578
|
+
{
|
|
1579
|
+
config,
|
|
1580
|
+
audio,
|
|
1581
|
+
},
|
|
1582
|
+
);
|
|
1072
1583
|
const screenTracks = await AgoraRTC.createScreenVideoTrack(
|
|
1073
1584
|
config,
|
|
1074
1585
|
audio,
|
|
1075
1586
|
);
|
|
1587
|
+
logger.log(
|
|
1588
|
+
LogSource.AgoraSDK,
|
|
1589
|
+
'API',
|
|
1590
|
+
'RTC [createScreenVideoTrack] screenshare tracks created successfully',
|
|
1591
|
+
{
|
|
1592
|
+
tracks: screenTracks,
|
|
1593
|
+
},
|
|
1594
|
+
);
|
|
1076
1595
|
if (this.isSingleTrack(screenTracks)) {
|
|
1077
1596
|
this.screenStream.video = screenTracks;
|
|
1078
1597
|
} else {
|
|
@@ -1080,24 +1599,55 @@ export default class RtcEngine {
|
|
|
1080
1599
|
this.screenStream.audio = screenTracks[1];
|
|
1081
1600
|
}
|
|
1082
1601
|
} catch (e) {
|
|
1083
|
-
|
|
1602
|
+
logger.error(
|
|
1603
|
+
LogSource.AgoraSDK,
|
|
1604
|
+
'API',
|
|
1605
|
+
'RTC [createScreenVideoTrack] Error while creating screenshare tracks',
|
|
1606
|
+
e,
|
|
1607
|
+
);
|
|
1084
1608
|
throw e;
|
|
1085
1609
|
}
|
|
1086
1610
|
|
|
1611
|
+
logger.log(
|
|
1612
|
+
LogSource.AgoraSDK,
|
|
1613
|
+
'API',
|
|
1614
|
+
'RTC [join] joining channel of screenclient',
|
|
1615
|
+
{
|
|
1616
|
+
appId: this.appId,
|
|
1617
|
+
channelName,
|
|
1618
|
+
token,
|
|
1619
|
+
optionalUid,
|
|
1620
|
+
},
|
|
1621
|
+
);
|
|
1087
1622
|
await this.screenClient.join(
|
|
1088
1623
|
this.appId,
|
|
1089
1624
|
channelName,
|
|
1090
1625
|
token || null,
|
|
1091
1626
|
optionalUid || null,
|
|
1092
1627
|
);
|
|
1093
|
-
|
|
1628
|
+
logger.log(
|
|
1629
|
+
LogSource.AgoraSDK,
|
|
1630
|
+
'API',
|
|
1631
|
+
'RTC [join] joined channel successfully',
|
|
1632
|
+
);
|
|
1094
1633
|
this.inScreenshare = true;
|
|
1634
|
+
logger.log(
|
|
1635
|
+
LogSource.AgoraSDK,
|
|
1636
|
+
'API',
|
|
1637
|
+
'RTC [publish] trying to publish tracks',
|
|
1638
|
+
this.screenStream,
|
|
1639
|
+
);
|
|
1095
1640
|
await this.screenClient.publish(
|
|
1096
1641
|
this.screenStream.audio
|
|
1097
1642
|
? [this.screenStream.video, this.screenStream.audio]
|
|
1098
1643
|
: this.screenStream.video,
|
|
1099
1644
|
);
|
|
1100
|
-
|
|
1645
|
+
logger.log(
|
|
1646
|
+
LogSource.AgoraSDK,
|
|
1647
|
+
'API',
|
|
1648
|
+
'RTC [publish] screenshare tracks published successfully',
|
|
1649
|
+
this.screenStream,
|
|
1650
|
+
);
|
|
1101
1651
|
this.screenStream.video.on('track-ended', () => {
|
|
1102
1652
|
(this.eventsMap.get('onUserOffline') as callbackType)(
|
|
1103
1653
|
{},
|