|
@@ -29,7 +29,6 @@ import java.util.Map;
|
29
|
29
|
import io.agora.rtc.Constants;
|
30
|
30
|
import io.agora.rtc.IAudioEffectManager;
|
31
|
31
|
import io.agora.rtc.IRtcEngineEventHandler;
|
32
|
|
-import io.agora.rtc.PublisherConfiguration;
|
33
|
32
|
import io.agora.rtc.RtcEngine;
|
34
|
33
|
import io.agora.rtc.live.LiveInjectStreamConfig;
|
35
|
34
|
import io.agora.rtc.live.LiveTranscoding;
|
|
@@ -258,6 +257,69 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
258
|
257
|
return constants;
|
259
|
258
|
}
|
260
|
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
|
+
|
261
|
323
|
private IRtcEngineEventHandler mRtcEventHandler = new IRtcEngineEventHandler() {
|
262
|
324
|
|
263
|
325
|
@Override
|
|
@@ -268,6 +330,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
268
|
330
|
WritableMap map = Arguments.createMap();
|
269
|
331
|
map.putString("message", "AgoraWarning");
|
270
|
332
|
map.putInt("code", code);
|
|
333
|
+ sendEvent(getReactApplicationContext(), AGWarning, map);
|
271
|
334
|
}
|
272
|
335
|
});
|
273
|
336
|
}
|
|
@@ -280,7 +343,25 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
280
|
343
|
WritableMap map = Arguments.createMap();
|
281
|
344
|
map.putString("message", "AgoraError");
|
282
|
345
|
map.putInt("code", code);
|
283
|
|
- sendEvent(getReactApplicationContext(), "onError", 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
|
+ }
|
284
|
365
|
}
|
285
|
366
|
});
|
286
|
367
|
}
|
|
@@ -294,7 +375,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
294
|
375
|
map.putString("channel", channel);
|
295
|
376
|
map.putInt("uid", uid);
|
296
|
377
|
map.putInt("elapsed", elapsed);
|
297
|
|
- sendEvent(getReactApplicationContext(), "onJoinChannelSuccess", map);
|
|
378
|
+ sendEvent(getReactApplicationContext(), AGJoinChannelSuccess, map);
|
298
|
379
|
}
|
299
|
380
|
});
|
300
|
381
|
}
|
|
@@ -308,7 +389,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
308
|
389
|
map.putString("channel", channel);
|
309
|
390
|
map.putInt("uid", uid);
|
310
|
391
|
map.putInt("elapsed", elapsed);
|
311
|
|
- sendEvent(getReactApplicationContext(), "onReJoinChannelSuccess", map); }
|
|
392
|
+ sendEvent(getReactApplicationContext(), AGRejoinChannelSuccess, map);
|
|
393
|
+ }
|
312
|
394
|
});
|
313
|
395
|
}
|
314
|
396
|
|
|
@@ -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(), "onLeaveChannel", 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(), "onClientRoleChanged", 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(), "onUserJoined", 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(), "onUserOffline", 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(), "onConnectionStateChanged", map);
|
|
471
|
+ sendEvent(getReactApplicationContext(), AGConnectionStateChanged, map);
|
390
|
472
|
}
|
391
|
473
|
});
|
392
|
474
|
}
|
|
@@ -398,24 +480,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
398
|
480
|
@Override
|
399
|
481
|
public void run() {
|
400
|
482
|
WritableMap map = Arguments.createMap();
|
401
|
|
- map.putString("message", "onConnectionLost");
|
402
|
|
- sendEvent(getReactApplicationContext(), "onConnectionLost", 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(), "onApiCallExecuted", map);
|
418
|
|
- }
|
|
483
|
+ map.putString("message", "connectionLost");
|
|
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(), "onTokenPrivilegeWillExpire", 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(), "onRequestToken", 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(), "onMicrophoneEnabled", 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(), "onAudioVolumeIndication", 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(), "onActiveSpeaker", 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(), "onFirstLocalAudioFrame", 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(), "onFirstRemoteAudioFrame", 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(), "onVideoStopped", 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(), "onFirstLocalVideoFrame", 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(), "onFirstRemoteVideoDecoded", 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(), "onFirstRemoteVideoFrame", 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(), "onUserMuteAudio", 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(), "onUserMuteVideo", 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(), "onUserEnableVideo", 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(), "onUserEnableLocalVideo", 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(), "onVideoSizeChanged", 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(), "onRemoteVideoStateChanged", 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(), "onLocalPublishFallbackToAudioOnly", 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(), "onRemoteSubscribeFallbackToAudioOnly", 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(), "onAudioRouteChanged", 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(), "onCameraReady", 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(), "onCameraFocusAreaChanged", 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(), "onCameraExposureAreaChanged", 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(), "onRtcStats", 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(), "onLastmileQuality", 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(), "onNetworkQuality", 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(), "onLocalVideoStats", map);
|
|
888
|
+ sendEvent(getReactApplicationContext(), AGLocalVideoStats, map);
|
807
|
889
|
}
|
808
|
890
|
});
|
809
|
891
|
}
|
|
@@ -815,31 +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);
|
818
|
|
- statsMap.putInt("delay", stats.delay);
|
|
900
|
+ statsMap.putInt("width", stats.width);
|
|
901
|
+ statsMap.putInt("height", stats.height);
|
819
|
902
|
statsMap.putInt("receivedBitrate", stats.receivedBitrate);
|
820
|
903
|
statsMap.putInt("receivedFrameRate", stats.receivedFrameRate);
|
821
|
904
|
statsMap.putInt("rxStreamType", stats.rxStreamType);
|
822
|
905
|
WritableMap map = Arguments.createMap();
|
823
|
906
|
map.putMap("stats", statsMap);
|
824
|
|
- sendEvent(getReactApplicationContext(), "onRemoteVideoStats", map);
|
825
|
|
- }
|
826
|
|
- });
|
827
|
|
- }
|
828
|
|
-
|
829
|
|
- @Override
|
830
|
|
- public void onRemoteAudioStats(final RemoteAudioStats stats) {
|
831
|
|
- runOnUiThread(new Runnable() {
|
832
|
|
- @Override
|
833
|
|
- public void run() {
|
834
|
|
- WritableMap statsMap = Arguments.createMap();
|
835
|
|
- statsMap.putInt("uid", stats.uid);
|
836
|
|
- statsMap.putInt("quality", stats.quality);
|
837
|
|
- statsMap.putInt("networkTransportDelay", stats.networkTransportDelay);
|
838
|
|
- statsMap.putInt("jitterBufferDelay", stats.jitterBufferDelay);
|
839
|
|
- statsMap.putInt("audioLossRate", stats.audioLossRate);
|
840
|
|
- WritableMap map = Arguments.createMap();
|
841
|
|
- map.putMap("stats", statsMap);
|
842
|
|
- sendEvent(getReactApplicationContext(), "onRemoteAudioStats", map);
|
|
907
|
+ sendEvent(getReactApplicationContext(), AGRemoteVideoStats, map);
|
843
|
908
|
}
|
844
|
909
|
});
|
845
|
910
|
}
|
|
@@ -859,7 +924,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
859
|
924
|
statsMap.putInt("rxKBitRate", rxKBitRate);
|
860
|
925
|
WritableMap map = Arguments.createMap();
|
861
|
926
|
map.putMap("stats", statsMap);
|
862
|
|
- sendEvent(getReactApplicationContext(), "onRemoteAudioTransportStats", map);
|
|
927
|
+ sendEvent(getReactApplicationContext(), AGAudioTransportStatsOfUid, map);
|
863
|
928
|
}
|
864
|
929
|
});
|
865
|
930
|
}
|
|
@@ -879,7 +944,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
879
|
944
|
statsMap.putInt("rxKBitRate", rxKBitRate);
|
880
|
945
|
WritableMap map = Arguments.createMap();
|
881
|
946
|
map.putMap("stats", statsMap);
|
882
|
|
- sendEvent(getReactApplicationContext(), "onRemoteVideoTransportStats", map);
|
|
947
|
+ sendEvent(getReactApplicationContext(), AGVideoTransportStatsOfUid, map);
|
883
|
948
|
}
|
884
|
949
|
});
|
885
|
950
|
}
|
|
@@ -891,7 +956,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
891
|
956
|
public void run() {
|
892
|
957
|
WritableMap map = Arguments.createMap();
|
893
|
958
|
map.putString("message", "LocalAudioMixingSucceedFinish");
|
894
|
|
- sendEvent(getReactApplicationContext(), "onAudioMixingFinish", map);
|
|
959
|
+ sendEvent(getReactApplicationContext(), AGLocalAudioMixingFinish, map);
|
895
|
960
|
}
|
896
|
961
|
});
|
897
|
962
|
}
|
|
@@ -903,20 +968,20 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
903
|
968
|
public void run() {
|
904
|
969
|
WritableMap map = Arguments.createMap();
|
905
|
970
|
map.putInt("soundId", soundId);
|
906
|
|
- sendEvent(getReactApplicationContext(), "onAudioEffectFinished", map);
|
|
971
|
+ sendEvent(getReactApplicationContext(), AGAudioEffectFinish, map);
|
907
|
972
|
}
|
908
|
973
|
});
|
909
|
974
|
}
|
910
|
975
|
|
911
|
976
|
@Override
|
912
|
|
- public void onStreamPublished(final String url, final int error) {
|
|
977
|
+ public void onStreamPublished(final String url, final int errorCode) {
|
913
|
978
|
runOnUiThread(new Runnable() {
|
914
|
979
|
@Override
|
915
|
980
|
public void run() {
|
916
|
981
|
WritableMap map = Arguments.createMap();
|
917
|
982
|
map.putString("url", url);
|
918
|
|
- map.putInt("error", error);
|
919
|
|
- sendEvent(getReactApplicationContext(), "onStreamPublished", map);
|
|
983
|
+ map.putInt("code", errorCode);
|
|
984
|
+ sendEvent(getReactApplicationContext(), AGStreamPublished, map);
|
920
|
985
|
}
|
921
|
986
|
});
|
922
|
987
|
}
|
|
@@ -928,7 +993,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
928
|
993
|
public void run() {
|
929
|
994
|
WritableMap map = Arguments.createMap();
|
930
|
995
|
map.putString("url", url);
|
931
|
|
- sendEvent(getReactApplicationContext(), "onStreamUnpublished", map);
|
|
996
|
+ sendEvent(getReactApplicationContext(), AGStreamUnpublish, map);
|
932
|
997
|
}
|
933
|
998
|
});
|
934
|
999
|
}
|
|
@@ -939,8 +1004,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
939
|
1004
|
@Override
|
940
|
1005
|
public void run() {
|
941
|
1006
|
WritableMap map = Arguments.createMap();
|
942
|
|
- map.putString("message", "TranscodingUpdated");
|
943
|
|
- sendEvent(getReactApplicationContext(), "onTranscodingUpdated", map);
|
|
1007
|
+ map.putString("message", "AGTranscodingUpdate");
|
|
1008
|
+ sendEvent(getReactApplicationContext(), AGTranscodingUpdate, map);
|
944
|
1009
|
}
|
945
|
1010
|
});
|
946
|
1011
|
}
|
|
@@ -951,10 +1016,10 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
951
|
1016
|
@Override
|
952
|
1017
|
public void run() {
|
953
|
1018
|
WritableMap map = Arguments.createMap();
|
954
|
|
- map.putString("url", url);
|
955
|
1019
|
map.putInt("uid", uid);
|
|
1020
|
+ map.putString("url", url);
|
956
|
1021
|
map.putInt("status", status);
|
957
|
|
- sendEvent(getReactApplicationContext(), "onStreamInjectedStatus", map);
|
|
1022
|
+ sendEvent(getReactApplicationContext(), AGStreamInjectedStatus, map);
|
958
|
1023
|
}
|
959
|
1024
|
});
|
960
|
1025
|
}
|
|
@@ -972,24 +1037,23 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
972
|
1037
|
map.putInt("uid", uid);
|
973
|
1038
|
map.putInt("streamId", streamId);
|
974
|
1039
|
map.putString("data", msg);
|
975
|
|
- sendEvent(getReactApplicationContext(), "onStreamMessage", map);
|
|
1040
|
+ sendEvent(getReactApplicationContext(), AGReceiveStreamMessage, map);
|
976
|
1041
|
}
|
977
|
1042
|
});
|
978
|
1043
|
}
|
979
|
1044
|
|
980
|
1045
|
@Override
|
981
|
|
- 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) {
|
982
|
1047
|
runOnUiThread(new Runnable() {
|
983
|
1048
|
@Override
|
984
|
1049
|
public void run() {
|
985
|
1050
|
WritableMap map = Arguments.createMap();
|
986
|
|
- map.putString("type", "onStreamMessageError");
|
987
|
1051
|
map.putInt("uid", uid);
|
988
|
1052
|
map.putInt("streamId", streamId);
|
989
|
|
- map.putInt("error", code);
|
|
1053
|
+ map.putInt("error", error);
|
990
|
1054
|
map.putInt("missed", missed);
|
991
|
1055
|
map.putInt("cached", cached);
|
992
|
|
- sendEvent(getReactApplicationContext(), "onStreamMessageError", map);
|
|
1056
|
+ sendEvent(getReactApplicationContext(), AGOccurStreamMessageError, map);
|
993
|
1057
|
}
|
994
|
1058
|
});
|
995
|
1059
|
}
|
|
@@ -1000,8 +1064,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1000
|
1064
|
@Override
|
1001
|
1065
|
public void run() {
|
1002
|
1066
|
WritableMap map = Arguments.createMap();
|
1003
|
|
- map.putString("message", "onMediaEngineLoadSuccess");
|
1004
|
|
- sendEvent(getReactApplicationContext(), "onMediaEngineLoadSuccess", map);
|
|
1067
|
+ map.putString("message", "MediaEngineLoaded");
|
|
1068
|
+ sendEvent(getReactApplicationContext(), AGMediaEngineLoaded, map);
|
1005
|
1069
|
}
|
1006
|
1070
|
});
|
1007
|
1071
|
}
|
|
@@ -1012,8 +1076,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1012
|
1076
|
@Override
|
1013
|
1077
|
public void run() {
|
1014
|
1078
|
WritableMap map = Arguments.createMap();
|
1015
|
|
- map.putString("message", "onMediaEngineStartCallSuccess");
|
1016
|
|
- sendEvent(getReactApplicationContext(), "onMediaEngineStartCallSuccess", map);
|
|
1079
|
+ map.putString("message", "AGMediaEngineStartCall");
|
|
1080
|
+ sendEvent(getReactApplicationContext(), AGMediaEngineStartCall, map);
|
1017
|
1081
|
}
|
1018
|
1082
|
});
|
1019
|
1083
|
}
|
|
@@ -1029,7 +1093,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1029
|
1093
|
Promise promise) {
|
1030
|
1094
|
try {
|
1031
|
1095
|
int res = AgoraManager.getInstance().renewToken(token);
|
1032
|
|
- if (res != 0) throw new ReactNativeAgoraException("renewToken Failed", res);
|
|
1096
|
+ if (res != 0) throw new ReactNativeAgoraException("renew token failed", res);
|
1033
|
1097
|
WritableMap map = Arguments.createMap();
|
1034
|
1098
|
map.putBoolean("success", true);
|
1035
|
1099
|
promise.resolve(map);
|
|
@@ -1074,7 +1138,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1074
|
1138
|
WritableMap err = Arguments.createMap();
|
1075
|
1139
|
err.putBoolean("success", false);
|
1076
|
1140
|
err.putString("message", e.toString());
|
1077
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1141
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1078
|
1142
|
}
|
1079
|
1143
|
}
|
1080
|
1144
|
|
|
@@ -1088,7 +1152,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1088
|
1152
|
err.putBoolean("success", false);
|
1089
|
1153
|
err.putString("message", e.toString());
|
1090
|
1154
|
err.putInt("code", ((ReactNativeAgoraException) e).getCode());
|
1091
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1155
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1092
|
1156
|
}
|
1093
|
1157
|
}
|
1094
|
1158
|
|
|
@@ -1118,7 +1182,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1118
|
1182
|
WritableMap err = Arguments.createMap();
|
1119
|
1183
|
err.putBoolean("success", false);
|
1120
|
1184
|
err.putString("message", e.toString());
|
1121
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1185
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1122
|
1186
|
}
|
1123
|
1187
|
}
|
1124
|
1188
|
|
|
@@ -1132,7 +1196,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1132
|
1196
|
WritableMap err = Arguments.createMap();
|
1133
|
1197
|
err.putBoolean("success", false);
|
1134
|
1198
|
err.putString("message", e.toString());
|
1135
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1199
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1136
|
1200
|
}
|
1137
|
1201
|
}
|
1138
|
1202
|
|
|
@@ -1155,7 +1219,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1155
|
1219
|
WritableMap err = Arguments.createMap();
|
1156
|
1220
|
err.putBoolean("success", false);
|
1157
|
1221
|
err.putString("message", e.toString());
|
1158
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1222
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1159
|
1223
|
}
|
1160
|
1224
|
}
|
1161
|
1225
|
|
|
@@ -1168,7 +1232,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1168
|
1232
|
WritableMap err = Arguments.createMap();
|
1169
|
1233
|
err.putBoolean("success", false);
|
1170
|
1234
|
err.putString("message", e.toString());
|
1171
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1235
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1172
|
1236
|
}
|
1173
|
1237
|
}
|
1174
|
1238
|
|
|
@@ -1301,6 +1365,19 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1301
|
1365
|
}
|
1302
|
1366
|
}
|
1303
|
1367
|
|
|
1368
|
+ @ReactMethod
|
|
1369
|
+ public void getCameraMaxZoomFactor(Promise promise) {
|
|
1370
|
+ try {
|
|
1371
|
+ double res = AgoraManager.getInstance().mRtcEngine.getCameraMaxZoomFactor();
|
|
1372
|
+ WritableMap map = Arguments.createMap();
|
|
1373
|
+ map.putBoolean("success", true);
|
|
1374
|
+ map.putDouble("value", res);
|
|
1375
|
+ promise.resolve(map);
|
|
1376
|
+ } catch (Exception e) {
|
|
1377
|
+ promise.reject(e);
|
|
1378
|
+ }
|
|
1379
|
+ }
|
|
1380
|
+
|
1304
|
1381
|
@ReactMethod
|
1305
|
1382
|
public void setCameraFocusPositionInPreview(ReadableMap options, Promise promise) {
|
1306
|
1383
|
try {
|
|
@@ -1353,7 +1430,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1353
|
1430
|
public void setCameraAutoFocusFaceModeEnabled(boolean enabled, Promise promise) {
|
1354
|
1431
|
try {
|
1355
|
1432
|
int res = AgoraManager.getInstance().mRtcEngine.setCameraAutoFocusFaceModeEnabled(enabled);
|
1356
|
|
- if (res != 0) throw new ReactNativeAgoraException("setCameraTorchOn Failed", res);
|
|
1433
|
+ if (res != 0) throw new ReactNativeAgoraException("setCameraAutoFocusFaceModeEnabled Failed", res);
|
1357
|
1434
|
WritableMap map = Arguments.createMap();
|
1358
|
1435
|
map.putBoolean("success", true);
|
1359
|
1436
|
map.putInt("value", res);
|
|
@@ -1428,7 +1505,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1428
|
1505
|
WritableMap err = Arguments.createMap();
|
1429
|
1506
|
err.putBoolean("success", false);
|
1430
|
1507
|
err.putString("message", e.toString());
|
1431
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1508
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1432
|
1509
|
}
|
1433
|
1510
|
}
|
1434
|
1511
|
|
|
@@ -1441,7 +1518,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1441
|
1518
|
WritableMap err = Arguments.createMap();
|
1442
|
1519
|
err.putBoolean("success", false);
|
1443
|
1520
|
err.putString("message", e.toString());
|
1444
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1521
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1445
|
1522
|
}
|
1446
|
1523
|
}
|
1447
|
1524
|
|
|
@@ -1494,7 +1571,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1494
|
1571
|
WritableMap err = Arguments.createMap();
|
1495
|
1572
|
err.putBoolean("success", false);
|
1496
|
1573
|
err.putString("message", e.toString());
|
1497
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1574
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1498
|
1575
|
}
|
1499
|
1576
|
}
|
1500
|
1577
|
|
|
@@ -1507,7 +1584,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1507
|
1584
|
WritableMap err = Arguments.createMap();
|
1508
|
1585
|
err.putBoolean("success", false);
|
1509
|
1586
|
err.putString("message", e.toString());
|
1510
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1587
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1511
|
1588
|
}
|
1512
|
1589
|
}
|
1513
|
1590
|
|
|
@@ -1520,7 +1597,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1520
|
1597
|
WritableMap err = Arguments.createMap();
|
1521
|
1598
|
err.putBoolean("success", false);
|
1522
|
1599
|
err.putString("message", e.toString());
|
1523
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1600
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1524
|
1601
|
}
|
1525
|
1602
|
}
|
1526
|
1603
|
|
|
@@ -1533,7 +1610,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1533
|
1610
|
WritableMap err = Arguments.createMap();
|
1534
|
1611
|
err.putBoolean("success", false);
|
1535
|
1612
|
err.putString("message", e.toString());
|
1536
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1613
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1537
|
1614
|
}
|
1538
|
1615
|
}
|
1539
|
1616
|
|
|
@@ -1546,7 +1623,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1546
|
1623
|
WritableMap err = Arguments.createMap();
|
1547
|
1624
|
err.putBoolean("success", false);
|
1548
|
1625
|
err.putString("message", e.toString());
|
1549
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1626
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1550
|
1627
|
}
|
1551
|
1628
|
}
|
1552
|
1629
|
|
|
@@ -1564,7 +1641,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1564
|
1641
|
WritableMap err = Arguments.createMap();
|
1565
|
1642
|
err.putBoolean("success", false);
|
1566
|
1643
|
err.putString("message", e.toString());
|
1567
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1644
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1568
|
1645
|
}
|
1569
|
1646
|
}
|
1570
|
1647
|
|
|
@@ -1577,7 +1654,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1577
|
1654
|
WritableMap err = Arguments.createMap();
|
1578
|
1655
|
err.putBoolean("success", false);
|
1579
|
1656
|
err.putString("message", e.toString());
|
1580
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1657
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1581
|
1658
|
}
|
1582
|
1659
|
}
|
1583
|
1660
|
|
|
@@ -1590,7 +1667,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1590
|
1667
|
WritableMap err = Arguments.createMap();
|
1591
|
1668
|
err.putBoolean("success", false);
|
1592
|
1669
|
err.putString("message", e.toString());
|
1593
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1670
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1594
|
1671
|
}
|
1595
|
1672
|
}
|
1596
|
1673
|
|
|
@@ -1603,7 +1680,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1603
|
1680
|
WritableMap err = Arguments.createMap();
|
1604
|
1681
|
err.putBoolean("success", false);
|
1605
|
1682
|
err.putString("message", e.toString());
|
1606
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1683
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1607
|
1684
|
}
|
1608
|
1685
|
}
|
1609
|
1686
|
|
|
@@ -1616,7 +1693,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1616
|
1693
|
WritableMap err = Arguments.createMap();
|
1617
|
1694
|
err.putBoolean("success", false);
|
1618
|
1695
|
err.putString("message", e.toString());
|
1619
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1696
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1620
|
1697
|
}
|
1621
|
1698
|
}
|
1622
|
1699
|
|
|
@@ -1629,7 +1706,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1629
|
1706
|
WritableMap err = Arguments.createMap();
|
1630
|
1707
|
err.putBoolean("success", false);
|
1631
|
1708
|
err.putString("message", e.toString());
|
1632
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1709
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1633
|
1710
|
}
|
1634
|
1711
|
}
|
1635
|
1712
|
|
|
@@ -1642,7 +1719,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1642
|
1719
|
WritableMap err = Arguments.createMap();
|
1643
|
1720
|
err.putBoolean("success", false);
|
1644
|
1721
|
err.putString("message", e.toString());
|
1645
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
1722
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
1646
|
1723
|
}
|
1647
|
1724
|
}
|
1648
|
1725
|
|
|
@@ -1769,7 +1846,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
1769
|
1846
|
public void disableLastmileTest(Promise promise) {
|
1770
|
1847
|
try {
|
1771
|
1848
|
int res = AgoraManager.getInstance().mRtcEngine
|
1772
|
|
- .enableLastmileTest();
|
|
1849
|
+ .disableLastmileTest();
|
1773
|
1850
|
if (res != 0) throw new ReactNativeAgoraException("disableLastmileTest Failed", res);
|
1774
|
1851
|
WritableMap map = Arguments.createMap();
|
1775
|
1852
|
map.putBoolean("success", true);
|
|
@@ -2013,21 +2090,22 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
2013
|
2090
|
@ReactMethod
|
2014
|
2091
|
public void addInjectStreamUrl(ReadableMap options, Promise promise) {
|
2015
|
2092
|
try {
|
2016
|
|
- LiveInjectStreamConfig config = new LiveInjectStreamConfig();
|
2017
|
|
- config.width = options.getInt("width");
|
2018
|
|
- config.height = options.getInt("height");
|
2019
|
|
- config.videoGop = options.getInt("videoGop");
|
2020
|
|
- config.videoBitrate = options.getInt("videoBitrate");
|
2021
|
|
- config.videoFramerate = options.getInt("videoFramerate");
|
2022
|
|
- config.audioBitrate = options.getInt("audioBitrate");
|
2023
|
|
- config.audioSampleRate = getAudioSampleRateEnum(options.getInt("audioSampleRate"));
|
2024
|
|
- config.audioChannels = options.getInt("audioChannels");
|
2025
|
|
-
|
|
2093
|
+ LiveInjectStreamConfig injectstream = new LiveInjectStreamConfig();
|
|
2094
|
+ ReadableMap config = options.getMap("config");
|
|
2095
|
+ ReadableMap size = config.getMap("size");
|
|
2096
|
+ injectstream.width = size.getInt("width");
|
|
2097
|
+ injectstream.height = size.getInt("height");
|
|
2098
|
+ injectstream.videoGop = config.getInt("videoGop");
|
|
2099
|
+ injectstream.videoBitrate = config.getInt("videoBitrate");
|
|
2100
|
+ injectstream.videoFramerate = config.getInt("videoFramerate");
|
|
2101
|
+ injectstream.audioBitrate = config.getInt("audioBitrate");
|
|
2102
|
+ injectstream.audioSampleRate = getAudioSampleRateEnum(config.getInt("audioSampleRate"));
|
|
2103
|
+ injectstream.audioChannels = config.getInt("audioChannels");
|
2026
|
2104
|
|
2027
|
2105
|
int res = AgoraManager.getInstance().mRtcEngine
|
2028
|
2106
|
.addInjectStreamUrl(
|
2029
|
2107
|
options.getString("url"),
|
2030
|
|
- config
|
|
2108
|
+ injectstream
|
2031
|
2109
|
);
|
2032
|
2110
|
if (res != 0) throw new ReactNativeAgoraException("addInjectStreamUrl Failed", res);
|
2033
|
2111
|
WritableMap map = Arguments.createMap();
|
|
@@ -2176,7 +2254,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
|
2176
|
2254
|
WritableMap err = Arguments.createMap();
|
2177
|
2255
|
err.putBoolean("success", false);
|
2178
|
2256
|
err.putString("message", e.toString());
|
2179
|
|
- sendEvent(getReactApplicationContext(), "onError", err);
|
|
2257
|
+ sendEvent(getReactApplicationContext(), "error", err);
|
2180
|
2258
|
}
|
2181
|
2259
|
}
|
2182
|
2260
|
|