|
@@ -257,6 +257,69 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
257
|
257
|
return constants;
|
258
|
258
|
}
|
259
|
259
|
|
|
260
|
+ private final static String AGWarning = "warning";
|
|
261
|
+ private final static String AGError = "error";
|
|
262
|
+ private final static String AGApiCallExecute = "apiCallExecute";
|
|
263
|
+ private final static String AGJoinChannelSuccess = "joinChannelSuccess";
|
|
264
|
+ private final static String AGRejoinChannelSuccess = "rejoinChannelSuccess";
|
|
265
|
+ private final static String AGLeaveChannel = "leaveChannel";
|
|
266
|
+ private final static String AGClientRoleChanged = "clientRoleChanged";
|
|
267
|
+ private final static String AGUserJoined = "userJoined";
|
|
268
|
+ private final static String AGUserOffline = "userOffline";
|
|
269
|
+ private final static String AGConnectionStateChanged = "connectionStateChanged";
|
|
270
|
+ private final static String AGConnectionLost = "connectionLost";
|
|
271
|
+ private final static String AGTokenPrivilegeWillExpire = "tokenPrivilegeWillExpire";
|
|
272
|
+ private final static String AGRequestToken = "requestToken";
|
|
273
|
+
|
|
274
|
+ private final static String AGMicrophoneEnabled = "microphoneEnabled";
|
|
275
|
+ private final static String AGAudioVolumeIndication = "audioVolumeIndication";
|
|
276
|
+ private final static String AGActiveSpeaker = "activeSpeaker";
|
|
277
|
+ private final static String AGFirstLocalAudioFrame = "firstLocalAudioFrame";
|
|
278
|
+ private final static String AGFirstRemoteAudioFrame = "firstRemoteAudioFrame";
|
|
279
|
+ private final static String AGVideoStopped = "videoStopped";
|
|
280
|
+ private final static String AGFirstLocalVideoFrame = "firstLocalVideoFrame";
|
|
281
|
+ private final static String AGFirstRemoteVideoDecoded = "firstRemoteVideoDecoded";
|
|
282
|
+ private final static String AGFirstRemoteVideoFrame = "firstRemoteVideoFrame";
|
|
283
|
+ private final static String AGUserMuteAudio = "userMuteAudio";
|
|
284
|
+ private final static String AGUserMuteVideo = "userMuteVideo";
|
|
285
|
+ private final static String AGUserEnableVideo = "userEnableVideo";
|
|
286
|
+ private final static String AGUserEnableLocalVideo = "userEnableLocalVideo";
|
|
287
|
+ private final static String AGVideoSizeChanged = "videoSizeChanged";
|
|
288
|
+ private final static String AGRemoteVideoStateChanged = "remoteVideoStateChanged";
|
|
289
|
+ private final static String AGLocalPublishFallbackToAudioOnly = "localPublishFallbackToAudioOnly";
|
|
290
|
+ private final static String AGRemoteSubscribeFallbackToAudioOnly = "remoteSubscribeFallbackToAudioOnly";
|
|
291
|
+
|
|
292
|
+ private final static String AGAudioRouteChanged = "audioRouteChanged";
|
|
293
|
+ private final static String AGCameraReady = "cameraReady";
|
|
294
|
+ private final static String AGCameraFocusAreaChanged = "cameraFocusAreaChanged";
|
|
295
|
+ private final static String AGCameraExposureAreaChanged = "cameraExposureAreaChanged";
|
|
296
|
+
|
|
297
|
+ private final static String AGRtcStats = "rtcStats";
|
|
298
|
+ private final static String AGLastmileQuality = "lastmileQuality";
|
|
299
|
+ private final static String AGNetworkQuality = "networkQuality";
|
|
300
|
+ private final static String AGLocalVideoStats = "localVideoStats";
|
|
301
|
+ private final static String AGRemoteVideoStats = "remoteVideoStats";
|
|
302
|
+ private final static String AGRemoteAudioStats = "remoteAudioStats";
|
|
303
|
+ private final static String AGAudioTransportStatsOfUid = "audioTransportStatsOfUid";
|
|
304
|
+ private final static String AGVideoTransportStatsOfUid = "videoTransportStatsOfUid";
|
|
305
|
+
|
|
306
|
+ private final static String AGLocalAudioMixingFinish = "localAudioMixingFinish";
|
|
307
|
+ private final static String AGRemoteAudioMixingStart = "remoteAudioMixingStart";
|
|
308
|
+ private final static String AGRemoteAudioMixingFinish = "remoteAudioMixingFinish";
|
|
309
|
+ private final static String AGAudioEffectFinish = "audioEffectFinish";
|
|
310
|
+
|
|
311
|
+ private final static String AGStreamPublished = "streamPublished";
|
|
312
|
+ private final static String AGStreamUnpublish = "streamUnpublish";
|
|
313
|
+ private final static String AGTranscodingUpdate = "transcodingUpdate";
|
|
314
|
+
|
|
315
|
+ private final static String AGStreamInjectedStatus = "streamInjectedStatus";
|
|
316
|
+
|
|
317
|
+ private final static String AGReceiveStreamMessage = "receiveStreamMessage";
|
|
318
|
+ private final static String AGOccurStreamMessageError = "occurStreamMessageError";
|
|
319
|
+
|
|
320
|
+ private final static String AGMediaEngineLoaded = "mediaEngineLoaded";
|
|
321
|
+ private final static String AGMediaEngineStartCall = "mediaEngineStartCall";
|
|
322
|
+
|
260
|
323
|
private IRtcEngineEventHandler mRtcEventHandler = new IRtcEngineEventHandler() {
|
261
|
324
|
|
262
|
325
|
@Override
|
|
@@ -267,6 +330,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
267
|
330
|
WritableMap map = Arguments.createMap();
|
268
|
331
|
map.putString("message", "AgoraWarning");
|
269
|
332
|
map.putInt("code", code);
|
|
333
|
+ sendEvent(getReactApplicationContext(), AGWarning, map);
|
270
|
334
|
}
|
271
|
335
|
});
|
272
|
336
|
}
|
|
@@ -279,7 +343,25 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
279
|
343
|
WritableMap map = Arguments.createMap();
|
280
|
344
|
map.putString("message", "AgoraError");
|
281
|
345
|
map.putInt("code", code);
|
282
|
|
- sendEvent(getReactApplicationContext(), "error", map);
|
|
346
|
+ sendEvent(getReactApplicationContext(), AGError, map);
|
|
347
|
+ }
|
|
348
|
+ });
|
|
349
|
+ }
|
|
350
|
+
|
|
351
|
+ @Override
|
|
352
|
+ public void onApiCallExecuted(final int code, final String api, final String result) {
|
|
353
|
+ runOnUiThread(new Runnable() {
|
|
354
|
+ @Override
|
|
355
|
+ public void run() {
|
|
356
|
+ WritableMap map = Arguments.createMap();
|
|
357
|
+ map.putInt("error", code);
|
|
358
|
+ map.putString("api", api);
|
|
359
|
+ map.putString("result", result);
|
|
360
|
+ if (code != 0) {
|
|
361
|
+ sendEvent(getReactApplicationContext(), AGError, map);
|
|
362
|
+ } else {
|
|
363
|
+ sendEvent(getReactApplicationContext(), AGApiCallExecute, map);
|
|
364
|
+ }
|
283
|
365
|
}
|
284
|
366
|
});
|
285
|
367
|
}
|
|
@@ -293,7 +375,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
293
|
375
|
map.putString("channel", channel);
|
294
|
376
|
map.putInt("uid", uid);
|
295
|
377
|
map.putInt("elapsed", elapsed);
|
296
|
|
- sendEvent(getReactApplicationContext(), "joinChannelSuccess", map);
|
|
378
|
+ sendEvent(getReactApplicationContext(), AGJoinChannelSuccess, map);
|
297
|
379
|
}
|
298
|
380
|
});
|
299
|
381
|
}
|
|
@@ -307,7 +389,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
307
|
389
|
map.putString("channel", channel);
|
308
|
390
|
map.putInt("uid", uid);
|
309
|
391
|
map.putInt("elapsed", elapsed);
|
310
|
|
- sendEvent(getReactApplicationContext(), "reJoinChannelSuccess", map);
|
|
392
|
+ sendEvent(getReactApplicationContext(), AGRejoinChannelSuccess, map);
|
311
|
393
|
}
|
312
|
394
|
});
|
313
|
395
|
}
|
|
@@ -318,23 +400,23 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
318
|
400
|
@Override
|
319
|
401
|
public void run() {
|
320
|
402
|
WritableMap statsMap = Arguments.createMap();
|
321
|
|
- statsMap.putInt("totalDuration", stats.totalDuration);
|
|
403
|
+ statsMap.putInt("duration", stats.totalDuration);
|
322
|
404
|
statsMap.putInt("txBytes", stats.txBytes);
|
323
|
405
|
statsMap.putInt("rxBytes", stats.rxBytes);
|
324
|
|
- statsMap.putInt("txKBitRate", stats.txKBitRate);
|
325
|
|
- statsMap.putInt("rxKBitRate", stats.rxKBitRate);
|
|
406
|
+ // statsMap.putInt("txKBitRate", stats.txKBitRate);
|
|
407
|
+ // statsMap.putInt("rxKBitRate", stats.rxKBitRate);
|
326
|
408
|
statsMap.putInt("txAudioKBitRate", stats.txAudioKBitRate);
|
327
|
409
|
statsMap.putInt("rxAudioKBitRate", stats.rxAudioKBitRate);
|
328
|
410
|
statsMap.putInt("txVideoKBitRate", stats.txVideoKBitRate);
|
329
|
411
|
statsMap.putInt("rxVideoKBitRate", stats.rxVideoKBitRate);
|
330
|
|
- statsMap.putInt("users", stats.users);
|
331
|
412
|
statsMap.putInt("lastmileDelay", stats.lastmileDelay);
|
332
|
|
- statsMap.putDouble("cpuTotalUsage", stats.cpuTotalUsage);
|
|
413
|
+ statsMap.putInt("userCount", stats.users);
|
333
|
414
|
statsMap.putDouble("cpuAppUsage", stats.cpuAppUsage);
|
|
415
|
+ statsMap.putDouble("cpuTotalUsage", stats.cpuTotalUsage);
|
334
|
416
|
|
335
|
417
|
WritableMap map = Arguments.createMap();
|
336
|
418
|
map.putMap("stats", statsMap);
|
337
|
|
- sendEvent(getReactApplicationContext(), "leaveChannel", map);
|
|
419
|
+ sendEvent(getReactApplicationContext(), AGLeaveChannel, map);
|
338
|
420
|
}
|
339
|
421
|
});
|
340
|
422
|
}
|
|
@@ -347,7 +429,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
347
|
429
|
WritableMap map = Arguments.createMap();
|
348
|
430
|
map.putInt("oldRole", oldRole);
|
349
|
431
|
map.putInt("newRole", newRole);
|
350
|
|
- sendEvent(getReactApplicationContext(), "clientRoleChanged", map);
|
|
432
|
+ sendEvent(getReactApplicationContext(), AGClientRoleChanged, map);
|
351
|
433
|
}
|
352
|
434
|
});
|
353
|
435
|
}
|
|
@@ -360,7 +442,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
360
|
442
|
WritableMap map = Arguments.createMap();
|
361
|
443
|
map.putInt("uid", uid);
|
362
|
444
|
map.putInt("elapsed", elapsed);
|
363
|
|
- sendEvent(getReactApplicationContext(), "userJoined", map);
|
|
445
|
+ sendEvent(getReactApplicationContext(), AGUserJoined, map);
|
364
|
446
|
}
|
365
|
447
|
});
|
366
|
448
|
}
|
|
@@ -373,7 +455,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
373
|
455
|
WritableMap map = Arguments.createMap();
|
374
|
456
|
map.putInt("uid", uid);
|
375
|
457
|
map.putInt("reason", reason);
|
376
|
|
- sendEvent(getReactApplicationContext(), "userOffline", map);
|
|
458
|
+ sendEvent(getReactApplicationContext(), AGUserOffline, map);
|
377
|
459
|
}
|
378
|
460
|
});
|
379
|
461
|
}
|
|
@@ -386,7 +468,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
386
|
468
|
WritableMap map = Arguments.createMap();
|
387
|
469
|
map.putInt("state", state);
|
388
|
470
|
map.putInt("reason", reason);
|
389
|
|
- sendEvent(getReactApplicationContext(), "connectionStateChanged", map);
|
|
471
|
+ sendEvent(getReactApplicationContext(), AGConnectionStateChanged, map);
|
390
|
472
|
}
|
391
|
473
|
});
|
392
|
474
|
}
|
|
@@ -399,23 +481,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
399
|
481
|
public void run() {
|
400
|
482
|
WritableMap map = Arguments.createMap();
|
401
|
483
|
map.putString("message", "connectionLost");
|
402
|
|
- sendEvent(getReactApplicationContext(), "connectionLost", map);
|
403
|
|
- }
|
404
|
|
- });
|
405
|
|
- }
|
406
|
|
-
|
407
|
|
- @Override
|
408
|
|
- public void onApiCallExecuted(final int code, final String api, final String result) {
|
409
|
|
- runOnUiThread(new Runnable() {
|
410
|
|
- @Override
|
411
|
|
- public void run() {
|
412
|
|
- if (code != 0) {
|
413
|
|
- WritableMap map = Arguments.createMap();
|
414
|
|
- map.putInt("error", code);
|
415
|
|
- map.putString("api", api);
|
416
|
|
- map.putString("result", result);
|
417
|
|
- sendEvent(getReactApplicationContext(), "apiCallExecuted", map);
|
418
|
|
- }
|
|
484
|
+ sendEvent(getReactApplicationContext(), AGConnectionLost, map);
|
419
|
485
|
}
|
420
|
486
|
});
|
421
|
487
|
}
|
|
@@ -427,7 +493,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
427
|
493
|
public void run() {
|
428
|
494
|
WritableMap map = Arguments.createMap();
|
429
|
495
|
map.putString("token", token);
|
430
|
|
- sendEvent(getReactApplicationContext(), "tokenPrivilegeWillExpire", map);
|
|
496
|
+ sendEvent(getReactApplicationContext(), AGTokenPrivilegeWillExpire, map);
|
431
|
497
|
}
|
432
|
498
|
});
|
433
|
499
|
}
|
|
@@ -439,7 +505,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
439
|
505
|
public void run() {
|
440
|
506
|
WritableMap map = Arguments.createMap();
|
441
|
507
|
map.putString("message", "RequestToken");
|
442
|
|
- sendEvent(getReactApplicationContext(), "requestToken", map);
|
|
508
|
+ sendEvent(getReactApplicationContext(), AGRequestToken, map);
|
443
|
509
|
}
|
444
|
510
|
});
|
445
|
511
|
}
|
|
@@ -451,7 +517,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
451
|
517
|
public void run() {
|
452
|
518
|
WritableMap map = Arguments.createMap();
|
453
|
519
|
map.putBoolean("enabled", enabled);
|
454
|
|
- sendEvent(getReactApplicationContext(), "microphoneEnabled", map);
|
|
520
|
+ sendEvent(getReactApplicationContext(), AGMicrophoneEnabled, map);
|
455
|
521
|
}
|
456
|
522
|
|
457
|
523
|
});
|
|
@@ -474,7 +540,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
474
|
540
|
WritableMap map = Arguments.createMap();
|
475
|
541
|
map.putArray("speakers", arr);
|
476
|
542
|
map.putInt("totalVolume", totalVolume);
|
477
|
|
- sendEvent(getReactApplicationContext(), "audioVolumeIndication", map);
|
|
543
|
+ sendEvent(getReactApplicationContext(), AGAudioVolumeIndication, map);
|
478
|
544
|
}
|
479
|
545
|
});
|
480
|
546
|
}
|
|
@@ -486,7 +552,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
486
|
552
|
public void run() {
|
487
|
553
|
WritableMap map = Arguments.createMap();
|
488
|
554
|
map.putInt("uid", uid);
|
489
|
|
- sendEvent(getReactApplicationContext(), "activeSpeaker", map);
|
|
555
|
+ sendEvent(getReactApplicationContext(), AGActiveSpeaker, map);
|
490
|
556
|
}
|
491
|
557
|
});
|
492
|
558
|
}
|
|
@@ -498,7 +564,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
498
|
564
|
public void run() {
|
499
|
565
|
WritableMap map = Arguments.createMap();
|
500
|
566
|
map.putInt("elapsed", elapsed);
|
501
|
|
- sendEvent(getReactApplicationContext(), "firstLocalAudioFrame", map);
|
|
567
|
+ sendEvent(getReactApplicationContext(), AGFirstLocalAudioFrame, map);
|
502
|
568
|
}
|
503
|
569
|
});
|
504
|
570
|
}
|
|
@@ -511,7 +577,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
511
|
577
|
WritableMap map = Arguments.createMap();
|
512
|
578
|
map.putInt("uid", uid);
|
513
|
579
|
map.putInt("elapsed", elapsed);
|
514
|
|
- sendEvent(getReactApplicationContext(), "firstRemoteAudioFrame", map);
|
|
580
|
+ sendEvent(getReactApplicationContext(), AGFirstRemoteAudioFrame, map);
|
515
|
581
|
}
|
516
|
582
|
});
|
517
|
583
|
}
|
|
@@ -523,7 +589,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
523
|
589
|
public void run() {
|
524
|
590
|
WritableMap map = Arguments.createMap();
|
525
|
591
|
map.putString("message", "VideoStopped");
|
526
|
|
- sendEvent(getReactApplicationContext(), "videoStopped", map);
|
|
592
|
+ sendEvent(getReactApplicationContext(), AGVideoStopped, map);
|
527
|
593
|
}
|
528
|
594
|
});
|
529
|
595
|
}
|
|
@@ -537,7 +603,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
537
|
603
|
map.putInt("width", width);
|
538
|
604
|
map.putInt("height", height);
|
539
|
605
|
map.putInt("elapsed", elapsed);
|
540
|
|
- sendEvent(getReactApplicationContext(), "firstLocalVideoFrame", map);
|
|
606
|
+ sendEvent(getReactApplicationContext(), AGFirstLocalVideoFrame, map);
|
541
|
607
|
}
|
542
|
608
|
});
|
543
|
609
|
}
|
|
@@ -555,7 +621,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
555
|
621
|
map.putInt("width", width);
|
556
|
622
|
map.putInt("height", height);
|
557
|
623
|
map.putInt("elapsed", elapsed);
|
558
|
|
- sendEvent(getReactApplicationContext(), "firstRemoteVideoDecoded", map);
|
|
624
|
+ sendEvent(getReactApplicationContext(), AGFirstRemoteVideoDecoded, map);
|
559
|
625
|
}
|
560
|
626
|
});
|
561
|
627
|
}
|
|
@@ -570,7 +636,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
570
|
636
|
map.putInt("width", width);
|
571
|
637
|
map.putInt("height", height);
|
572
|
638
|
map.putInt("elapsed", elapsed);
|
573
|
|
- sendEvent(getReactApplicationContext(), "firstRemoteVideoFrame", map);
|
|
639
|
+ sendEvent(getReactApplicationContext(), AGFirstRemoteVideoFrame, map);
|
574
|
640
|
}
|
575
|
641
|
});
|
576
|
642
|
}
|
|
@@ -581,9 +647,9 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
581
|
647
|
@Override
|
582
|
648
|
public void run() {
|
583
|
649
|
WritableMap map = Arguments.createMap();
|
584
|
|
- map.putInt("uid", uid);
|
585
|
650
|
map.putBoolean("muted", muted);
|
586
|
|
- sendEvent(getReactApplicationContext(), "userMuteAudio", map);
|
|
651
|
+ map.putInt("uid", uid);
|
|
652
|
+ sendEvent(getReactApplicationContext(), AGUserMuteAudio, map);
|
587
|
653
|
}
|
588
|
654
|
});
|
589
|
655
|
}
|
|
@@ -594,35 +660,35 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
594
|
660
|
@Override
|
595
|
661
|
public void run() {
|
596
|
662
|
WritableMap map = Arguments.createMap();
|
597
|
|
- map.putInt("uid", uid);
|
598
|
663
|
map.putBoolean("muted", muted);
|
599
|
|
- sendEvent(getReactApplicationContext(), "userMuteVideo", map);
|
|
664
|
+ map.putInt("uid", uid);
|
|
665
|
+ sendEvent(getReactApplicationContext(), AGUserMuteVideo, map);
|
600
|
666
|
}
|
601
|
667
|
});
|
602
|
668
|
}
|
603
|
669
|
|
604
|
670
|
@Override
|
605
|
|
- public void onUserEnableVideo(final int uid, final boolean muted) {
|
|
671
|
+ public void onUserEnableVideo(final int uid, final boolean enabled) {
|
606
|
672
|
runOnUiThread(new Runnable() {
|
607
|
673
|
@Override
|
608
|
674
|
public void run() {
|
609
|
675
|
WritableMap map = Arguments.createMap();
|
|
676
|
+ map.putBoolean("enabled", enabled);
|
610
|
677
|
map.putInt("uid", uid);
|
611
|
|
- map.putBoolean("muted", muted);
|
612
|
|
- sendEvent(getReactApplicationContext(), "userEnableVideo", map);
|
|
678
|
+ sendEvent(getReactApplicationContext(), AGUserEnableVideo, map);
|
613
|
679
|
}
|
614
|
680
|
});
|
615
|
681
|
}
|
616
|
682
|
|
617
|
683
|
@Override
|
618
|
|
- public void onUserEnableLocalVideo(final int uid, final boolean muted) {
|
|
684
|
+ public void onUserEnableLocalVideo(final int uid, final boolean enabled) {
|
619
|
685
|
runOnUiThread(new Runnable() {
|
620
|
686
|
@Override
|
621
|
687
|
public void run() {
|
622
|
688
|
WritableMap map = Arguments.createMap();
|
|
689
|
+ map.putBoolean("enabled", enabled);
|
623
|
690
|
map.putInt("uid", uid);
|
624
|
|
- map.putBoolean("muted", muted);
|
625
|
|
- sendEvent(getReactApplicationContext(), "userEnableLocalVideo", map);
|
|
691
|
+ sendEvent(getReactApplicationContext(), AGUserEnableLocalVideo, map);
|
626
|
692
|
}
|
627
|
693
|
});
|
628
|
694
|
}
|
|
@@ -637,7 +703,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
637
|
703
|
map.putInt("width", width);
|
638
|
704
|
map.putInt("height", height);
|
639
|
705
|
map.putInt("rotation", rotation);
|
640
|
|
- sendEvent(getReactApplicationContext(), "videoSizeChanged", map);
|
|
706
|
+ sendEvent(getReactApplicationContext(), AGVideoSizeChanged, map);
|
641
|
707
|
}
|
642
|
708
|
});
|
643
|
709
|
}
|
|
@@ -650,7 +716,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
650
|
716
|
WritableMap map = Arguments.createMap();
|
651
|
717
|
map.putInt("uid", uid);
|
652
|
718
|
map.putInt("state", state);
|
653
|
|
- sendEvent(getReactApplicationContext(), "remoteVideoStateChanged", map);
|
|
719
|
+ sendEvent(getReactApplicationContext(), AGRemoteVideoStateChanged, map);
|
654
|
720
|
}
|
655
|
721
|
});
|
656
|
722
|
}
|
|
@@ -662,7 +728,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
662
|
728
|
public void run() {
|
663
|
729
|
WritableMap map = Arguments.createMap();
|
664
|
730
|
map.putBoolean("isFallbackOrRecover", isFallbackOrRecover);
|
665
|
|
- sendEvent(getReactApplicationContext(), "localPublishFallbackToAudioOnly", map);
|
|
731
|
+ sendEvent(getReactApplicationContext(), AGLocalPublishFallbackToAudioOnly, map);
|
666
|
732
|
}
|
667
|
733
|
});
|
668
|
734
|
}
|
|
@@ -673,9 +739,9 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
673
|
739
|
@Override
|
674
|
740
|
public void run() {
|
675
|
741
|
WritableMap map = Arguments.createMap();
|
676
|
|
- map.putInt("uid", uid);
|
677
|
742
|
map.putBoolean("isFallbackOrRecover", isFallbackOrRecover);
|
678
|
|
- sendEvent(getReactApplicationContext(), "remoteSubscribeFallbackToAudioOnly", map);
|
|
743
|
+ map.putInt("uid", uid);
|
|
744
|
+ sendEvent(getReactApplicationContext(), AGRemoteSubscribeFallbackToAudioOnly, map);
|
679
|
745
|
}
|
680
|
746
|
});
|
681
|
747
|
}
|
|
@@ -687,7 +753,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
687
|
753
|
public void run() {
|
688
|
754
|
WritableMap map = Arguments.createMap();
|
689
|
755
|
map.putInt("routing", routing);
|
690
|
|
- sendEvent(getReactApplicationContext(), "audioRouteChanged", map);
|
|
756
|
+ sendEvent(getReactApplicationContext(), AGAudioRouteChanged, map);
|
691
|
757
|
}
|
692
|
758
|
});
|
693
|
759
|
}
|
|
@@ -699,7 +765,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
699
|
765
|
public void run() {
|
700
|
766
|
WritableMap map = Arguments.createMap();
|
701
|
767
|
map.putString("message", "CameraDidReady");
|
702
|
|
- sendEvent(getReactApplicationContext(), "cameraReady", map);
|
|
768
|
+ sendEvent(getReactApplicationContext(), AGCameraReady, map);
|
703
|
769
|
}
|
704
|
770
|
});
|
705
|
771
|
}
|
|
@@ -716,7 +782,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
716
|
782
|
rectMap.putInt("left", rect.left);
|
717
|
783
|
WritableMap map = Arguments.createMap();
|
718
|
784
|
map.putMap("rect", rectMap);
|
719
|
|
- sendEvent(getReactApplicationContext(), "cameraFocusAreaChanged", map);
|
|
785
|
+ sendEvent(getReactApplicationContext(), AGCameraFocusAreaChanged, map);
|
720
|
786
|
}
|
721
|
787
|
});
|
722
|
788
|
}
|
|
@@ -733,7 +799,25 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
733
|
799
|
rectMap.putInt("left", rect.left);
|
734
|
800
|
WritableMap map = Arguments.createMap();
|
735
|
801
|
map.putMap("rect", rectMap);
|
736
|
|
- sendEvent(getReactApplicationContext(), "cameraExposureAreaChanged", map);
|
|
802
|
+ sendEvent(getReactApplicationContext(), AGCameraExposureAreaChanged, map);
|
|
803
|
+ }
|
|
804
|
+ });
|
|
805
|
+ }
|
|
806
|
+
|
|
807
|
+ @Override
|
|
808
|
+ public void onRemoteAudioStats(final RemoteAudioStats stats) {
|
|
809
|
+ runOnUiThread(new Runnable() {
|
|
810
|
+ @Override
|
|
811
|
+ public void run() {
|
|
812
|
+ WritableMap statsMap = Arguments.createMap();
|
|
813
|
+ statsMap.putInt("uid", stats.uid);
|
|
814
|
+ statsMap.putInt("quality", stats.quality);
|
|
815
|
+ statsMap.putInt("networkTransportDelay", stats.networkTransportDelay);
|
|
816
|
+ statsMap.putInt("jitterBufferDelay", stats.jitterBufferDelay);
|
|
817
|
+ statsMap.putInt("audioLossRate", stats.audioLossRate);
|
|
818
|
+ WritableMap map = Arguments.createMap();
|
|
819
|
+ map.putMap("stats", statsMap);
|
|
820
|
+ sendEvent(getReactApplicationContext(), AGRemoteAudioStats, map);
|
737
|
821
|
}
|
738
|
822
|
});
|
739
|
823
|
}
|
|
@@ -744,23 +828,21 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
744
|
828
|
@Override
|
745
|
829
|
public void run() {
|
746
|
830
|
WritableMap statsMap = Arguments.createMap();
|
747
|
|
- statsMap.putInt("totalDuration", stats.totalDuration);
|
|
831
|
+ statsMap.putInt("duration", stats.totalDuration);
|
748
|
832
|
statsMap.putInt("txBytes", stats.txBytes);
|
749
|
833
|
statsMap.putInt("rxBytes", stats.rxBytes);
|
750
|
|
- statsMap.putInt("txKBitRate", stats.txKBitRate);
|
751
|
|
- statsMap.putInt("rxKBitRate", stats.rxKBitRate);
|
752
|
834
|
statsMap.putInt("txAudioKBitRate", stats.txAudioKBitRate);
|
753
|
835
|
statsMap.putInt("rxAudioKBitRate", stats.rxAudioKBitRate);
|
754
|
836
|
statsMap.putInt("txVideoKBitRate", stats.txVideoKBitRate);
|
755
|
837
|
statsMap.putInt("rxVideoKBitRate", stats.rxVideoKBitRate);
|
756
|
|
- statsMap.putInt("users", stats.users);
|
757
|
838
|
statsMap.putInt("lastmileDelay", stats.lastmileDelay);
|
758
|
|
- statsMap.putDouble("cpuTotalUsage", stats.cpuTotalUsage);
|
|
839
|
+ statsMap.putInt("userCount", stats.users);
|
759
|
840
|
statsMap.putDouble("cpuAppUsage", stats.cpuAppUsage);
|
|
841
|
+ statsMap.putDouble("cpuTotalUsage", stats.cpuTotalUsage);
|
760
|
842
|
|
761
|
843
|
WritableMap map = Arguments.createMap();
|
762
|
844
|
map.putMap("stats", statsMap);
|
763
|
|
- sendEvent(getReactApplicationContext(), "rtcStats", map);
|
|
845
|
+ sendEvent(getReactApplicationContext(), AGRtcStats, map);
|
764
|
846
|
}
|
765
|
847
|
});
|
766
|
848
|
}
|
|
@@ -772,7 +854,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
772
|
854
|
public void run() {
|
773
|
855
|
WritableMap map = Arguments.createMap();
|
774
|
856
|
map.putInt("quality", quality);
|
775
|
|
- sendEvent(getReactApplicationContext(), "lastmileQuality", map);
|
|
857
|
+ sendEvent(getReactApplicationContext(), AGLastmileQuality, map);
|
776
|
858
|
}
|
777
|
859
|
});
|
778
|
860
|
}
|
|
@@ -786,7 +868,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
786
|
868
|
map.putInt("uid", uid);
|
787
|
869
|
map.putInt("txQuality", txQuality);
|
788
|
870
|
map.putInt("rxQuality", rxQuality);
|
789
|
|
- sendEvent(getReactApplicationContext(), "networkQuality", map);
|
|
871
|
+ sendEvent(getReactApplicationContext(), AGNetworkQuality, map);
|
790
|
872
|
}
|
791
|
873
|
});
|
792
|
874
|
}
|
|
@@ -803,7 +885,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
803
|
885
|
|
804
|
886
|
WritableMap map = Arguments.createMap();
|
805
|
887
|
map.putMap("stats", statsMap);
|
806
|
|
- sendEvent(getReactApplicationContext(), "localVideoStats", map);
|
|
888
|
+ sendEvent(getReactApplicationContext(), AGLocalVideoStats, map);
|
807
|
889
|
}
|
808
|
890
|
});
|
809
|
891
|
}
|
|
@@ -815,30 +897,14 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
815
|
897
|
public void run() {
|
816
|
898
|
WritableMap statsMap = Arguments.createMap();
|
817
|
899
|
statsMap.putInt("uid", stats.uid);
|
|
900
|
+ statsMap.putInt("width", stats.width);
|
|
901
|
+ statsMap.putInt("height", stats.height);
|
818
|
902
|
statsMap.putInt("receivedBitrate", stats.receivedBitrate);
|
819
|
903
|
statsMap.putInt("receivedFrameRate", stats.receivedFrameRate);
|
820
|
904
|
statsMap.putInt("rxStreamType", stats.rxStreamType);
|
821
|
905
|
WritableMap map = Arguments.createMap();
|
822
|
906
|
map.putMap("stats", statsMap);
|
823
|
|
- sendEvent(getReactApplicationContext(), "remoteVideoStats", map);
|
824
|
|
- }
|
825
|
|
- });
|
826
|
|
- }
|
827
|
|
-
|
828
|
|
- @Override
|
829
|
|
- public void onRemoteAudioStats(final RemoteAudioStats stats) {
|
830
|
|
- runOnUiThread(new Runnable() {
|
831
|
|
- @Override
|
832
|
|
- public void run() {
|
833
|
|
- WritableMap statsMap = Arguments.createMap();
|
834
|
|
- statsMap.putInt("uid", stats.uid);
|
835
|
|
- statsMap.putInt("quality", stats.quality);
|
836
|
|
- statsMap.putInt("networkTransportDelay", stats.networkTransportDelay);
|
837
|
|
- statsMap.putInt("jitterBufferDelay", stats.jitterBufferDelay);
|
838
|
|
- statsMap.putInt("audioLossRate", stats.audioLossRate);
|
839
|
|
- WritableMap map = Arguments.createMap();
|
840
|
|
- map.putMap("stats", statsMap);
|
841
|
|
- sendEvent(getReactApplicationContext(), "remoteAudioStats", map);
|
|
907
|
+ sendEvent(getReactApplicationContext(), AGRemoteVideoStats, map);
|
842
|
908
|
}
|
843
|
909
|
});
|
844
|
910
|
}
|
|
@@ -858,7 +924,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
858
|
924
|
statsMap.putInt("rxKBitRate", rxKBitRate);
|
859
|
925
|
WritableMap map = Arguments.createMap();
|
860
|
926
|
map.putMap("stats", statsMap);
|
861
|
|
- sendEvent(getReactApplicationContext(), "remoteAudioTransportStats", map);
|
|
927
|
+ sendEvent(getReactApplicationContext(), AGAudioTransportStatsOfUid, map);
|
862
|
928
|
}
|
863
|
929
|
});
|
864
|
930
|
}
|
|
@@ -878,7 +944,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
878
|
944
|
statsMap.putInt("rxKBitRate", rxKBitRate);
|
879
|
945
|
WritableMap map = Arguments.createMap();
|
880
|
946
|
map.putMap("stats", statsMap);
|
881
|
|
- sendEvent(getReactApplicationContext(), "remoteVideoTransportStats", map);
|
|
947
|
+ sendEvent(getReactApplicationContext(), AGVideoTransportStatsOfUid, map);
|
882
|
948
|
}
|
883
|
949
|
});
|
884
|
950
|
}
|
|
@@ -890,7 +956,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
890
|
956
|
public void run() {
|
891
|
957
|
WritableMap map = Arguments.createMap();
|
892
|
958
|
map.putString("message", "LocalAudioMixingSucceedFinish");
|
893
|
|
- sendEvent(getReactApplicationContext(), "audioMixingFinish", map);
|
|
959
|
+ sendEvent(getReactApplicationContext(), AGLocalAudioMixingFinish, map);
|
894
|
960
|
}
|
895
|
961
|
});
|
896
|
962
|
}
|
|
@@ -902,20 +968,20 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
902
|
968
|
public void run() {
|
903
|
969
|
WritableMap map = Arguments.createMap();
|
904
|
970
|
map.putInt("soundId", soundId);
|
905
|
|
- sendEvent(getReactApplicationContext(), "audioEffectFinished", map);
|
|
971
|
+ sendEvent(getReactApplicationContext(), AGAudioEffectFinish, map);
|
906
|
972
|
}
|
907
|
973
|
});
|
908
|
974
|
}
|
909
|
975
|
|
910
|
976
|
@Override
|
911
|
|
- public void onStreamPublished(final String url, final int error) {
|
|
977
|
+ public void onStreamPublished(final String url, final int errorCode) {
|
912
|
978
|
runOnUiThread(new Runnable() {
|
913
|
979
|
@Override
|
914
|
980
|
public void run() {
|
915
|
981
|
WritableMap map = Arguments.createMap();
|
916
|
982
|
map.putString("url", url);
|
917
|
|
- map.putInt("error", error);
|
918
|
|
- sendEvent(getReactApplicationContext(), "streamPublished", map);
|
|
983
|
+ map.putInt("code", errorCode);
|
|
984
|
+ sendEvent(getReactApplicationContext(), AGStreamPublished, map);
|
919
|
985
|
}
|
920
|
986
|
});
|
921
|
987
|
}
|
|
@@ -927,7 +993,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
927
|
993
|
public void run() {
|
928
|
994
|
WritableMap map = Arguments.createMap();
|
929
|
995
|
map.putString("url", url);
|
930
|
|
- sendEvent(getReactApplicationContext(), "streamUnpublished", map);
|
|
996
|
+ sendEvent(getReactApplicationContext(), AGStreamUnpublish, map);
|
931
|
997
|
}
|
932
|
998
|
});
|
933
|
999
|
}
|
|
@@ -938,8 +1004,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
938
|
1004
|
@Override
|
939
|
1005
|
public void run() {
|
940
|
1006
|
WritableMap map = Arguments.createMap();
|
941
|
|
- map.putString("message", "TranscodingUpdated");
|
942
|
|
- sendEvent(getReactApplicationContext(), "transcodingUpdated", map);
|
|
1007
|
+ map.putString("message", "AGTranscodingUpdate");
|
|
1008
|
+ sendEvent(getReactApplicationContext(), AGTranscodingUpdate, map);
|
943
|
1009
|
}
|
944
|
1010
|
});
|
945
|
1011
|
}
|
|
@@ -950,10 +1016,10 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
950
|
1016
|
@Override
|
951
|
1017
|
public void run() {
|
952
|
1018
|
WritableMap map = Arguments.createMap();
|
953
|
|
- map.putString("url", url);
|
954
|
1019
|
map.putInt("uid", uid);
|
|
1020
|
+ map.putString("url", url);
|
955
|
1021
|
map.putInt("status", status);
|
956
|
|
- sendEvent(getReactApplicationContext(), "streamInjectedStatus", map);
|
|
1022
|
+ sendEvent(getReactApplicationContext(), AGStreamInjectedStatus, map);
|
957
|
1023
|
}
|
958
|
1024
|
});
|
959
|
1025
|
}
|
|
@@ -971,24 +1037,23 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
971
|
1037
|
map.putInt("uid", uid);
|
972
|
1038
|
map.putInt("streamId", streamId);
|
973
|
1039
|
map.putString("data", msg);
|
974
|
|
- sendEvent(getReactApplicationContext(), "streamMessage", map);
|
|
1040
|
+ sendEvent(getReactApplicationContext(), AGReceiveStreamMessage, map);
|
975
|
1041
|
}
|
976
|
1042
|
});
|
977
|
1043
|
}
|
978
|
1044
|
|
979
|
1045
|
@Override
|
980
|
|
- public void onStreamMessageError(final int uid, final int streamId, final int code, final int missed, final int cached) {
|
|
1046
|
+ public void onStreamMessageError(final int uid, final int streamId, final int error, final int missed, final int cached) {
|
981
|
1047
|
runOnUiThread(new Runnable() {
|
982
|
1048
|
@Override
|
983
|
1049
|
public void run() {
|
984
|
1050
|
WritableMap map = Arguments.createMap();
|
985
|
|
- map.putString("type", "streamMessageError");
|
986
|
1051
|
map.putInt("uid", uid);
|
987
|
1052
|
map.putInt("streamId", streamId);
|
988
|
|
- map.putInt("error", code);
|
|
1053
|
+ map.putInt("error", error);
|
989
|
1054
|
map.putInt("missed", missed);
|
990
|
1055
|
map.putInt("cached", cached);
|
991
|
|
- sendEvent(getReactApplicationContext(), "streamMessageError", map);
|
|
1056
|
+ sendEvent(getReactApplicationContext(), AGOccurStreamMessageError, map);
|
992
|
1057
|
}
|
993
|
1058
|
});
|
994
|
1059
|
}
|
|
@@ -999,8 +1064,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
999
|
1064
|
@Override
|
1000
|
1065
|
public void run() {
|
1001
|
1066
|
WritableMap map = Arguments.createMap();
|
1002
|
|
- map.putString("message", "mediaEngineLoadSuccess");
|
1003
|
|
- sendEvent(getReactApplicationContext(), "mediaEngineLoadSuccess", map);
|
|
1067
|
+ map.putString("message", "MediaEngineLoaded");
|
|
1068
|
+ sendEvent(getReactApplicationContext(), AGMediaEngineLoaded, map);
|
1004
|
1069
|
}
|
1005
|
1070
|
});
|
1006
|
1071
|
}
|
|
@@ -1011,8 +1076,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1011
|
1076
|
@Override
|
1012
|
1077
|
public void run() {
|
1013
|
1078
|
WritableMap map = Arguments.createMap();
|
1014
|
|
- map.putString("message", "mediaEngineStartCallSuccess");
|
1015
|
|
- sendEvent(getReactApplicationContext(), "mediaEngineStartCallSuccess", map);
|
|
1079
|
+ map.putString("message", "AGMediaEngineStartCall");
|
|
1080
|
+ sendEvent(getReactApplicationContext(), AGMediaEngineStartCall, map);
|
1016
|
1081
|
}
|
1017
|
1082
|
});
|
1018
|
1083
|
}
|