agora-electron-sdk 4.3.2 → 4.4.0-dev.2

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.
Files changed (123) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/gulpfile.js +3 -1
  3. package/js/AgoraSdk.js +5 -5
  4. package/js/Private/AgoraBase.js +374 -333
  5. package/js/Private/AgoraMediaBase.js +293 -78
  6. package/js/Private/AgoraMediaPlayerTypes.js +12 -30
  7. package/js/Private/IAgoraH265Transcoder.js +2 -5
  8. package/js/Private/IAgoraLog.js +6 -5
  9. package/js/Private/IAgoraMediaEngine.js +2 -5
  10. package/js/Private/IAgoraMediaPlayer.js +4 -10
  11. package/js/Private/IAgoraMediaRecorder.js +2 -5
  12. package/js/Private/IAgoraMediaStreamingSource.js +2 -5
  13. package/js/Private/IAgoraMusicContentCenter.js +21 -68
  14. package/js/Private/IAgoraRhythmPlayer.js +14 -17
  15. package/js/Private/IAgoraRtcEngine.js +76 -130
  16. package/js/Private/IAgoraRtcEngineEx.js +5 -28
  17. package/js/Private/IAgoraSpatialAudio.js +6 -15
  18. package/js/Private/IAudioDeviceManager.js +2 -5
  19. package/js/Private/impl/AgoraMediaBaseImpl.js +11 -14
  20. package/js/Private/impl/IAgoraH265TranscoderImpl.js +43 -46
  21. package/js/Private/impl/IAgoraMediaEngineImpl.js +155 -172
  22. package/js/Private/impl/IAgoraMediaPlayerImpl.js +534 -546
  23. package/js/Private/impl/IAgoraMediaRecorderImpl.js +26 -29
  24. package/js/Private/impl/IAgoraMusicContentCenterImpl.js +218 -251
  25. package/js/Private/impl/IAgoraRtcEngineExImpl.js +434 -436
  26. package/js/Private/impl/IAgoraRtcEngineImpl.js +2429 -2439
  27. package/js/Private/impl/IAgoraSpatialAudioImpl.js +167 -170
  28. package/js/Private/impl/IAudioDeviceManagerImpl.js +232 -235
  29. package/js/Private/internal/AgoraH265TranscoderInternal.js +33 -57
  30. package/js/Private/internal/AgoraMediaBaseInternal.js +9 -28
  31. package/js/Private/internal/AudioDeviceManagerInternal.js +24 -44
  32. package/js/Private/internal/IrisApiEngine.js +94 -145
  33. package/js/Private/internal/LocalSpatialAudioEngineInternal.js +3 -23
  34. package/js/Private/internal/MediaEngineInternal.js +69 -94
  35. package/js/Private/internal/MediaPlayerInternal.js +105 -125
  36. package/js/Private/internal/MediaRecorderInternal.js +37 -64
  37. package/js/Private/internal/MusicContentCenterInternal.js +92 -129
  38. package/js/Private/internal/RtcEngineExInternal.js +219 -243
  39. package/js/Private/ti/AgoraBase-ti.js +2 -2
  40. package/js/Private/ti/AgoraMediaBase-ti.js +2 -2
  41. package/js/Private/ti/AgoraMediaPlayerTypes-ti.js +1 -1
  42. package/js/Private/ti/IAgoraH265Transcoder-ti.js +2 -2
  43. package/js/Private/ti/IAgoraLog-ti.js +1 -1
  44. package/js/Private/ti/IAgoraMediaEngine-ti.js +1 -1
  45. package/js/Private/ti/IAgoraMediaPlayer-ti.js +2 -2
  46. package/js/Private/ti/IAgoraMediaPlayerSource-ti.js +2 -2
  47. package/js/Private/ti/IAgoraMediaRecorder-ti.js +1 -1
  48. package/js/Private/ti/IAgoraMediaStreamingSource-ti.js +1 -1
  49. package/js/Private/ti/IAgoraMusicContentCenter-ti.js +2 -2
  50. package/js/Private/ti/IAgoraRhythmPlayer-ti.js +1 -1
  51. package/js/Private/ti/IAgoraRtcEngine-ti.js +7 -7
  52. package/js/Private/ti/IAgoraRtcEngineEx-ti.js +1 -1
  53. package/js/Private/ti/IAgoraSpatialAudio-ti.js +1 -1
  54. package/js/Private/ti/IAudioDeviceManager-ti.js +1 -1
  55. package/js/Renderer/AgoraView.js +120 -146
  56. package/js/Renderer/IRenderer.js +43 -53
  57. package/js/Renderer/IRendererManager.js +119 -132
  58. package/js/Renderer/RendererCache.js +63 -96
  59. package/js/Renderer/RendererManager.js +35 -69
  60. package/js/Renderer/WebGLRenderer/index.js +77 -106
  61. package/js/Renderer/YUVCanvasRenderer/index.js +18 -40
  62. package/js/Utils.js +45 -64
  63. package/package.json +13 -7
  64. package/scripts/checkElectron.js +41 -0
  65. package/scripts/downloadPrebuild.js +54 -16
  66. package/scripts/synclib.js +6 -6
  67. package/ts/AgoraSdk.ts +1 -1
  68. package/ts/Private/AgoraBase.ts +282 -13
  69. package/ts/Private/AgoraMediaBase.ts +390 -32
  70. package/ts/Private/IAgoraLog.ts +4 -0
  71. package/ts/Private/IAgoraMediaEngine.ts +10 -21
  72. package/ts/Private/IAgoraMediaPlayer.ts +2 -0
  73. package/ts/Private/IAgoraRhythmPlayer.ts +12 -12
  74. package/ts/Private/IAgoraRtcEngine.ts +243 -237
  75. package/ts/Private/IAgoraRtcEngineEx.ts +34 -26
  76. package/ts/Private/IAudioDeviceManager.ts +4 -4
  77. package/ts/Private/impl/IAgoraRtcEngineExImpl.ts +30 -0
  78. package/ts/Private/impl/IAgoraRtcEngineImpl.ts +181 -103
  79. package/ts/Private/internal/IrisApiEngine.ts +3 -7
  80. package/ts/Private/internal/MediaEngineInternal.ts +0 -1
  81. package/ts/Private/internal/RtcEngineExInternal.ts +14 -5
  82. package/ts/Private/ti/IAgoraRtcEngine-ti.ts +5 -5
  83. package/ts/Renderer/AgoraView.ts +33 -4
  84. package/ts/Renderer/IRenderer.ts +1 -2
  85. package/ts/Renderer/IRendererManager.ts +41 -14
  86. package/ts/Renderer/RendererCache.ts +2 -2
  87. package/ts/Types.ts +1 -1
  88. package/ts/Utils.ts +15 -0
  89. package/types/AgoraSdk.d.ts +1 -1
  90. package/types/Private/AgoraBase.d.ts +277 -17
  91. package/types/Private/AgoraBase.d.ts.map +1 -1
  92. package/types/Private/AgoraMediaBase.d.ts +382 -32
  93. package/types/Private/AgoraMediaBase.d.ts.map +1 -1
  94. package/types/Private/IAgoraLog.d.ts +5 -1
  95. package/types/Private/IAgoraLog.d.ts.map +1 -1
  96. package/types/Private/IAgoraMediaEngine.d.ts +10 -21
  97. package/types/Private/IAgoraMediaEngine.d.ts.map +1 -1
  98. package/types/Private/IAgoraMediaPlayer.d.ts +2 -0
  99. package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -1
  100. package/types/Private/IAgoraRhythmPlayer.d.ts +12 -12
  101. package/types/Private/IAgoraRtcEngine.d.ts +219 -232
  102. package/types/Private/IAgoraRtcEngine.d.ts.map +1 -1
  103. package/types/Private/IAgoraRtcEngineEx.d.ts +30 -27
  104. package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -1
  105. package/types/Private/IAudioDeviceManager.d.ts +4 -4
  106. package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts +3 -1
  107. package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts.map +1 -1
  108. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +13 -9
  109. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -1
  110. package/types/Private/internal/IrisApiEngine.d.ts.map +1 -1
  111. package/types/Private/internal/MediaEngineInternal.d.ts.map +1 -1
  112. package/types/Private/internal/RtcEngineExInternal.d.ts +1 -0
  113. package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -1
  114. package/types/Renderer/AgoraView.d.ts +8 -2
  115. package/types/Renderer/AgoraView.d.ts.map +1 -1
  116. package/types/Renderer/IRenderer.d.ts.map +1 -1
  117. package/types/Renderer/IRendererManager.d.ts.map +1 -1
  118. package/types/Renderer/RendererCache.d.ts +1 -1
  119. package/types/Renderer/RendererCache.d.ts.map +1 -1
  120. package/types/Types.d.ts +1 -1
  121. package/types/Types.d.ts.map +1 -1
  122. package/types/Utils.d.ts +4 -0
  123. package/types/Utils.d.ts.map +1 -1
@@ -20,6 +20,9 @@ import {
20
20
  EarMonitoringFilterType,
21
21
  EchoTestConfiguration,
22
22
  EncryptionConfig,
23
+ FaceShapeArea,
24
+ FaceShapeAreaOptions,
25
+ FaceShapeBeautyOptions,
23
26
  FocalLengthInfo,
24
27
  HeadphoneEqualizerPreset,
25
28
  IAudioEncodedFrameObserver,
@@ -35,6 +38,7 @@ import {
35
38
  ScreenScenarioType,
36
39
  SegmentationProperty,
37
40
  SenderOptions,
41
+ SimulcastConfig,
38
42
  SimulcastStreamConfig,
39
43
  SimulcastStreamMode,
40
44
  SpatialAudioParams,
@@ -51,6 +55,7 @@ import {
51
55
  VideoStreamType,
52
56
  VideoSubscriptionOptions,
53
57
  VirtualBackgroundSource,
58
+ VoiceAiTunerType,
54
59
  VoiceBeautifierPreset,
55
60
  VoiceConversionPreset,
56
61
  WatermarkOptions,
@@ -416,7 +421,7 @@ export function processIRtcEngineEventHandler(
416
421
 
417
422
  case 'onLocalVideoStats':
418
423
  if (handler.onLocalVideoStats !== undefined) {
419
- handler.onLocalVideoStats(jsonParams.source, jsonParams.stats);
424
+ handler.onLocalVideoStats(jsonParams.connection, jsonParams.stats);
420
425
  }
421
426
  break;
422
427
 
@@ -910,34 +915,32 @@ export function processIRtcEngineEventHandler(
910
915
  }
911
916
  break;
912
917
 
913
- case 'onExtensionEvent':
914
- if (handler.onExtensionEvent !== undefined) {
915
- handler.onExtensionEvent(
916
- jsonParams.provider,
917
- jsonParams.extension,
918
+ case 'onExtensionEventWithContext':
919
+ if (handler.onExtensionEventWithContext !== undefined) {
920
+ handler.onExtensionEventWithContext(
921
+ jsonParams.context,
918
922
  jsonParams.key,
919
923
  jsonParams.value
920
924
  );
921
925
  }
922
926
  break;
923
927
 
924
- case 'onExtensionStarted':
925
- if (handler.onExtensionStarted !== undefined) {
926
- handler.onExtensionStarted(jsonParams.provider, jsonParams.extension);
928
+ case 'onExtensionStartedWithContext':
929
+ if (handler.onExtensionStartedWithContext !== undefined) {
930
+ handler.onExtensionStartedWithContext(jsonParams.context);
927
931
  }
928
932
  break;
929
933
 
930
- case 'onExtensionStopped':
931
- if (handler.onExtensionStopped !== undefined) {
932
- handler.onExtensionStopped(jsonParams.provider, jsonParams.extension);
934
+ case 'onExtensionStoppedWithContext':
935
+ if (handler.onExtensionStoppedWithContext !== undefined) {
936
+ handler.onExtensionStoppedWithContext(jsonParams.context);
933
937
  }
934
938
  break;
935
939
 
936
- case 'onExtensionError':
937
- if (handler.onExtensionError !== undefined) {
938
- handler.onExtensionError(
939
- jsonParams.provider,
940
- jsonParams.extension,
940
+ case 'onExtensionErrorWithContext':
941
+ if (handler.onExtensionErrorWithContext !== undefined) {
942
+ handler.onExtensionErrorWithContext(
943
+ jsonParams.context,
941
944
  jsonParams.error,
942
945
  jsonParams.message
943
946
  );
@@ -1619,6 +1622,116 @@ export class IRtcEngineImpl implements IRtcEngine {
1619
1622
  return 'RtcEngine_setBeautyEffectOptions_e7635d1';
1620
1623
  }
1621
1624
 
1625
+ setFaceShapeBeautyOptions(
1626
+ enabled: boolean,
1627
+ options: FaceShapeBeautyOptions,
1628
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1629
+ ): number {
1630
+ const apiType = this.getApiTypeFromSetFaceShapeBeautyOptions(
1631
+ enabled,
1632
+ options,
1633
+ type
1634
+ );
1635
+ const jsonParams = {
1636
+ enabled: enabled,
1637
+ options: options,
1638
+ type: type,
1639
+ toJSON: () => {
1640
+ return {
1641
+ enabled: enabled,
1642
+ options: options,
1643
+ type: type,
1644
+ };
1645
+ },
1646
+ };
1647
+ const jsonResults = callIrisApi.call(this, apiType, jsonParams);
1648
+ return jsonResults.result;
1649
+ }
1650
+
1651
+ protected getApiTypeFromSetFaceShapeBeautyOptions(
1652
+ enabled: boolean,
1653
+ options: FaceShapeBeautyOptions,
1654
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1655
+ ): string {
1656
+ return 'RtcEngine_setFaceShapeBeautyOptions_a862ce7';
1657
+ }
1658
+
1659
+ setFaceShapeAreaOptions(
1660
+ options: FaceShapeAreaOptions,
1661
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1662
+ ): number {
1663
+ const apiType = this.getApiTypeFromSetFaceShapeAreaOptions(options, type);
1664
+ const jsonParams = {
1665
+ options: options,
1666
+ type: type,
1667
+ toJSON: () => {
1668
+ return {
1669
+ options: options,
1670
+ type: type,
1671
+ };
1672
+ },
1673
+ };
1674
+ const jsonResults = callIrisApi.call(this, apiType, jsonParams);
1675
+ return jsonResults.result;
1676
+ }
1677
+
1678
+ protected getApiTypeFromSetFaceShapeAreaOptions(
1679
+ options: FaceShapeAreaOptions,
1680
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1681
+ ): string {
1682
+ return 'RtcEngine_setFaceShapeAreaOptions_2e242a3';
1683
+ }
1684
+
1685
+ getFaceShapeBeautyOptions(
1686
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1687
+ ): FaceShapeBeautyOptions {
1688
+ const apiType = this.getApiTypeFromGetFaceShapeBeautyOptions(type);
1689
+ const jsonParams = {
1690
+ type: type,
1691
+ toJSON: () => {
1692
+ return {
1693
+ type: type,
1694
+ };
1695
+ },
1696
+ };
1697
+ const jsonResults = callIrisApi.call(this, apiType, jsonParams);
1698
+ const options = jsonResults.options;
1699
+ return options;
1700
+ }
1701
+
1702
+ protected getApiTypeFromGetFaceShapeBeautyOptions(
1703
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1704
+ ): string {
1705
+ return 'RtcEngine_getFaceShapeBeautyOptions_8382895';
1706
+ }
1707
+
1708
+ getFaceShapeAreaOptions(
1709
+ shapeArea: FaceShapeArea,
1710
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1711
+ ): FaceShapeAreaOptions {
1712
+ const apiType = this.getApiTypeFromGetFaceShapeAreaOptions(shapeArea, type);
1713
+ const jsonParams = {
1714
+ shapeArea: shapeArea,
1715
+ type: type,
1716
+ toJSON: () => {
1717
+ return {
1718
+ shapeArea: shapeArea,
1719
+ type: type,
1720
+ };
1721
+ },
1722
+ };
1723
+ const jsonResults = callIrisApi.call(this, apiType, jsonParams);
1724
+ const options = jsonResults.options;
1725
+ return options;
1726
+ }
1727
+
1728
+ protected getApiTypeFromGetFaceShapeAreaOptions(
1729
+ shapeArea: FaceShapeArea,
1730
+ type: MediaSourceType = MediaSourceType.PrimaryCameraSource
1731
+ ): string {
1732
+ return 'RtcEngine_getFaceShapeAreaOptions_0783e2c';
1733
+ }
1734
+
1622
1735
  setLowlightEnhanceOptions(
1623
1736
  enabled: boolean,
1624
1737
  options: LowlightEnhanceOptions,
@@ -1958,27 +2071,6 @@ export class IRtcEngineImpl implements IRtcEngine {
1958
2071
  return 'RtcEngine_muteAllRemoteAudioStreams_5039d15';
1959
2072
  }
1960
2073
 
1961
- setDefaultMuteAllRemoteAudioStreams(mute: boolean): number {
1962
- const apiType =
1963
- this.getApiTypeFromSetDefaultMuteAllRemoteAudioStreams(mute);
1964
- const jsonParams = {
1965
- mute: mute,
1966
- toJSON: () => {
1967
- return {
1968
- mute: mute,
1969
- };
1970
- },
1971
- };
1972
- const jsonResults = callIrisApi.call(this, apiType, jsonParams);
1973
- return jsonResults.result;
1974
- }
1975
-
1976
- protected getApiTypeFromSetDefaultMuteAllRemoteAudioStreams(
1977
- mute: boolean
1978
- ): string {
1979
- return 'RtcEngine_setDefaultMuteAllRemoteAudioStreams_5039d15';
1980
- }
1981
-
1982
2074
  muteRemoteAudioStream(uid: number, mute: boolean): number {
1983
2075
  const apiType = this.getApiTypeFromMuteRemoteAudioStream(uid, mute);
1984
2076
  const jsonParams = {
@@ -2056,27 +2148,6 @@ export class IRtcEngineImpl implements IRtcEngine {
2056
2148
  return 'RtcEngine_muteAllRemoteVideoStreams_5039d15';
2057
2149
  }
2058
2150
 
2059
- setDefaultMuteAllRemoteVideoStreams(mute: boolean): number {
2060
- const apiType =
2061
- this.getApiTypeFromSetDefaultMuteAllRemoteVideoStreams(mute);
2062
- const jsonParams = {
2063
- mute: mute,
2064
- toJSON: () => {
2065
- return {
2066
- mute: mute,
2067
- };
2068
- },
2069
- };
2070
- const jsonResults = callIrisApi.call(this, apiType, jsonParams);
2071
- return jsonResults.result;
2072
- }
2073
-
2074
- protected getApiTypeFromSetDefaultMuteAllRemoteVideoStreams(
2075
- mute: boolean
2076
- ): string {
2077
- return 'RtcEngine_setDefaultMuteAllRemoteVideoStreams_5039d15';
2078
- }
2079
-
2080
2151
  setRemoteDefaultVideoStreamType(streamType: VideoStreamType): number {
2081
2152
  const apiType =
2082
2153
  this.getApiTypeFromSetRemoteDefaultVideoStreamType(streamType);
@@ -3488,6 +3559,29 @@ export class IRtcEngineImpl implements IRtcEngine {
3488
3559
  return 'RtcEngine_setHeadphoneEQParameters_4e92b3c';
3489
3560
  }
3490
3561
 
3562
+ enableVoiceAITuner(enabled: boolean, type: VoiceAiTunerType): number {
3563
+ const apiType = this.getApiTypeFromEnableVoiceAITuner(enabled, type);
3564
+ const jsonParams = {
3565
+ enabled: enabled,
3566
+ type: type,
3567
+ toJSON: () => {
3568
+ return {
3569
+ enabled: enabled,
3570
+ type: type,
3571
+ };
3572
+ },
3573
+ };
3574
+ const jsonResults = callIrisApi.call(this, apiType, jsonParams);
3575
+ return jsonResults.result;
3576
+ }
3577
+
3578
+ protected getApiTypeFromEnableVoiceAITuner(
3579
+ enabled: boolean,
3580
+ type: VoiceAiTunerType
3581
+ ): string {
3582
+ return 'RtcEngine_enableVoiceAITuner_28f5d5b';
3583
+ }
3584
+
3491
3585
  setLogFile(filePath: string): number {
3492
3586
  const apiType = this.getApiTypeFromSetLogFile(filePath);
3493
3587
  const jsonParams = {
@@ -3730,6 +3824,26 @@ export class IRtcEngineImpl implements IRtcEngine {
3730
3824
  return 'RtcEngine_setDualStreamMode_b3a4f6c';
3731
3825
  }
3732
3826
 
3827
+ setSimulcastConfig(simulcastConfig: SimulcastConfig): number {
3828
+ const apiType = this.getApiTypeFromSetSimulcastConfig(simulcastConfig);
3829
+ const jsonParams = {
3830
+ simulcastConfig: simulcastConfig,
3831
+ toJSON: () => {
3832
+ return {
3833
+ simulcastConfig: simulcastConfig,
3834
+ };
3835
+ },
3836
+ };
3837
+ const jsonResults = callIrisApi.call(this, apiType, jsonParams);
3838
+ return jsonResults.result;
3839
+ }
3840
+
3841
+ protected getApiTypeFromSetSimulcastConfig(
3842
+ simulcastConfig: SimulcastConfig
3843
+ ): string {
3844
+ return 'RtcEngine_setSimulcastConfig_3dcdfd7';
3845
+ }
3846
+
3733
3847
  enableCustomAudioLocalPlayback(trackId: number, enabled: boolean): number {
3734
3848
  const apiType = this.getApiTypeFromEnableCustomAudioLocalPlayback(
3735
3849
  trackId,
@@ -5686,42 +5800,6 @@ export class IRtcEngineImpl implements IRtcEngine {
5686
5800
  return 'RtcEngine_setRemoteUserPriority_f34115b';
5687
5801
  }
5688
5802
 
5689
- setEncryptionMode(encryptionMode: string): number {
5690
- const apiType = this.getApiTypeFromSetEncryptionMode(encryptionMode);
5691
- const jsonParams = {
5692
- encryptionMode: encryptionMode,
5693
- toJSON: () => {
5694
- return {
5695
- encryptionMode: encryptionMode,
5696
- };
5697
- },
5698
- };
5699
- const jsonResults = callIrisApi.call(this, apiType, jsonParams);
5700
- return jsonResults.result;
5701
- }
5702
-
5703
- protected getApiTypeFromSetEncryptionMode(encryptionMode: string): string {
5704
- return 'RtcEngine_setEncryptionMode_3a2037f';
5705
- }
5706
-
5707
- setEncryptionSecret(secret: string): number {
5708
- const apiType = this.getApiTypeFromSetEncryptionSecret(secret);
5709
- const jsonParams = {
5710
- secret: secret,
5711
- toJSON: () => {
5712
- return {
5713
- secret: secret,
5714
- };
5715
- },
5716
- };
5717
- const jsonResults = callIrisApi.call(this, apiType, jsonParams);
5718
- return jsonResults.result;
5719
- }
5720
-
5721
- protected getApiTypeFromSetEncryptionSecret(secret: string): string {
5722
- return 'RtcEngine_setEncryptionSecret_3a2037f';
5723
- }
5724
-
5725
5803
  enableEncryption(enabled: boolean, config: EncryptionConfig): number {
5726
5804
  const apiType = this.getApiTypeFromEnableEncryption(enabled, config);
5727
5805
  const jsonParams = {
@@ -6884,7 +6962,7 @@ export class IRtcEngineImpl implements IRtcEngine {
6884
6962
  }
6885
6963
 
6886
6964
  protected getApiTypeFromGetAudioDeviceManager(): string {
6887
- return 'RtcEngine_queryInterface_257d192';
6965
+ return 'RtcEngine_getAudioDeviceManager';
6888
6966
  }
6889
6967
 
6890
6968
  getVideoDeviceManager(): IVideoDeviceManager {
@@ -6895,7 +6973,7 @@ export class IRtcEngineImpl implements IRtcEngine {
6895
6973
  }
6896
6974
 
6897
6975
  protected getApiTypeFromGetVideoDeviceManager(): string {
6898
- return 'RtcEngine_queryInterface_257d192';
6976
+ return 'RtcEngine_getVideoDeviceManager';
6899
6977
  }
6900
6978
 
6901
6979
  getMusicContentCenter(): IMusicContentCenter {
@@ -6906,7 +6984,7 @@ export class IRtcEngineImpl implements IRtcEngine {
6906
6984
  }
6907
6985
 
6908
6986
  protected getApiTypeFromGetMusicContentCenter(): string {
6909
- return 'RtcEngine_queryInterface_257d192';
6987
+ return 'RtcEngine_getMusicContentCenter';
6910
6988
  }
6911
6989
 
6912
6990
  getMediaEngine(): IMediaEngine {
@@ -6917,7 +6995,7 @@ export class IRtcEngineImpl implements IRtcEngine {
6917
6995
  }
6918
6996
 
6919
6997
  protected getApiTypeFromGetMediaEngine(): string {
6920
- return 'RtcEngine_queryInterface_257d192';
6998
+ return 'RtcEngine_getMediaEngine';
6921
6999
  }
6922
7000
 
6923
7001
  getLocalSpatialAudioEngine(): ILocalSpatialAudioEngine {
@@ -6928,7 +7006,7 @@ export class IRtcEngineImpl implements IRtcEngine {
6928
7006
  }
6929
7007
 
6930
7008
  protected getApiTypeFromGetLocalSpatialAudioEngine(): string {
6931
- return 'RtcEngine_queryInterface_257d192';
7009
+ return 'RtcEngine_getLocalSpatialAudioEngine';
6932
7010
  }
6933
7011
 
6934
7012
  getH265Transcoder(): IH265Transcoder {
@@ -6939,7 +7017,7 @@ export class IRtcEngineImpl implements IRtcEngine {
6939
7017
  }
6940
7018
 
6941
7019
  protected getApiTypeFromGetH265Transcoder(): string {
6942
- return 'RtcEngine_queryInterface_257d192';
7020
+ return 'RtcEngine_getH265Transcoder';
6943
7021
  }
6944
7022
 
6945
7023
  sendMetaData(metadata: Metadata, sourceType: VideoSourceType): number {
@@ -6997,7 +7075,7 @@ export class IRtcEngineImpl implements IRtcEngine {
6997
7075
  }
6998
7076
 
6999
7077
  protected getApiTypeFromDestroyRendererByView(view: any): string {
7000
- return 'RtcEngine_destroyRendererByView';
7078
+ return 'RtcEngine_destroyRendererByView_a55f55f';
7001
7079
  }
7002
7080
 
7003
7081
  destroyRendererByConfig(
@@ -7030,7 +7108,7 @@ export class IRtcEngineImpl implements IRtcEngine {
7030
7108
  channelId?: string,
7031
7109
  uid: number = 0
7032
7110
  ): string {
7033
- return 'RtcEngine_destroyRendererByConfig';
7111
+ return 'RtcEngine_destroyRendererByConfig_542c2ae';
7034
7112
  }
7035
7113
 
7036
7114
  unregisterAudioEncodedFrameObserver(
@@ -1,5 +1,6 @@
1
1
  import EventEmitter from 'eventemitter3';
2
- import JSON from 'json-bigint';
2
+ import JSONBigInt from 'json-bigint';
3
+ const JSON = JSONBigInt({ storeAsString: true });
3
4
 
4
5
  import { AgoraEnv, logDebug, logError, logInfo, logWarn } from '../../Utils';
5
6
  import { IAudioEncodedFrameObserver } from '../AgoraBase';
@@ -339,12 +340,7 @@ export const EVENT_PROCESSORS: EventProcessors = {
339
340
  break;
340
341
  }
341
342
  },
342
- handlers: (event: string, data: any) => {
343
- if (event === 'onLocalVideoStats' && 'connection' in data) {
344
- return undefined;
345
- }
346
- return RtcEngineExInternal._event_handlers;
347
- },
343
+ handlers: (event: string, data: any) => RtcEngineExInternal._event_handlers,
348
344
  },
349
345
  IMusicContentCenterEventHandler: {
350
346
  suffix: 'MusicContentCenterEventHandler_',
@@ -109,7 +109,6 @@ export class MediaEngineInternal extends IMediaEngineImpl {
109
109
  MediaEngineInternal._video_encoded_frame_observers = [];
110
110
  MediaEngineInternal._face_info_observers = [];
111
111
  this.removeAllListeners();
112
- super.release();
113
112
  }
114
113
 
115
114
  _addListenerPreCheck<EventType extends keyof IMediaEngineEvent>(
@@ -1,6 +1,12 @@
1
1
  import { createCheckers } from 'ts-interface-checker';
2
2
 
3
- import { AgoraEnv, logError } from '../../Utils';
3
+ import { AgoraEnv, logError, parseIntPtr2Number } from '../../Utils';
4
+ let RendererManager: any;
5
+ if (typeof window !== 'undefined') {
6
+ RendererManager = require('../../Renderer/RendererManager').RendererManager;
7
+ } else {
8
+ RendererManager = undefined;
9
+ }
4
10
  import {
5
11
  AudioEncodedFrameObserverConfig,
6
12
  ClientRoleOptions,
@@ -89,8 +95,7 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
89
95
  if (AgoraEnv.webEnvReady) {
90
96
  // @ts-ignore
91
97
  window.AgoraEnv = AgoraEnv;
92
- if (AgoraEnv.AgoraRendererManager === undefined) {
93
- const { RendererManager } = require('../../Renderer/RendererManager');
98
+ if (AgoraEnv.AgoraRendererManager === undefined && RendererManager) {
94
99
  AgoraEnv.AgoraRendererManager = new RendererManager();
95
100
  }
96
101
  }
@@ -105,8 +110,6 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
105
110
  AgoraEnv.AgoraElectronBridge.ReleaseRenderer();
106
111
  AgoraEnv.AgoraRendererManager?.release();
107
112
  AgoraEnv.AgoraRendererManager = undefined;
108
- this._audio_device_manager.release();
109
- this._video_device_manager.release();
110
113
  this._media_engine.release();
111
114
  this._local_spatial_audio_engine.release();
112
115
  RtcEngineExInternal._event_handlers = [];
@@ -419,6 +422,11 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
419
422
  return this._h265_transcoder;
420
423
  }
421
424
 
425
+ override getNativeHandle(): number {
426
+ let result = super.getNativeHandle();
427
+ return parseIntPtr2Number(result);
428
+ }
429
+
422
430
  override registerAudioEncodedFrameObserver(
423
431
  config: AudioEncodedFrameObserverConfig,
424
432
  observer: IAudioEncodedFrameObserver
@@ -507,6 +515,7 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
507
515
  value.iconImage.length!
508
516
  );
509
517
  }
518
+ value.sourceDisplayId = parseIntPtr2Number(value.sourceDisplayId);
510
519
  return value;
511
520
  }
512
521
  );
@@ -40,7 +40,7 @@ export const IRtcEngineEventHandler = t.iface([], {
40
40
  "onUserEnableLocalVideo": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("remoteUid", "number"), t.param("enabled", "boolean"))),
41
41
  "onRemoteAudioStats": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("stats", "RemoteAudioStats"))),
42
42
  "onLocalAudioStats": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("stats", "LocalAudioStats"))),
43
- "onLocalVideoStats": t.opt(t.func("void", t.param("source", "VideoSourceType"), t.param("stats", "LocalVideoStats"))),
43
+ "onLocalVideoStats": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("stats", "LocalVideoStats"))),
44
44
  "onRemoteVideoStats": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("stats", "RemoteVideoStats"))),
45
45
  "onCameraReady": t.opt(t.func("void")),
46
46
  "onCameraFocusAreaChanged": t.opt(t.func("void", t.param("x", "number"), t.param("y", "number"), t.param("width", "number"), t.param("height", "number"))),
@@ -95,10 +95,10 @@ export const IRtcEngineEventHandler = t.iface([], {
95
95
  "onVideoPublishStateChanged": t.opt(t.func("void", t.param("source", "VideoSourceType"), t.param("channel", "string"), t.param("oldState", "StreamPublishState"), t.param("newState", "StreamPublishState"), t.param("elapseSinceLastState", "number"))),
96
96
  "onTranscodedStreamLayoutInfo": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("uid", "number"), t.param("width", "number"), t.param("height", "number"), t.param("layoutCount", "number"), t.param("layoutlist", t.array("VideoLayout")))),
97
97
  "onAudioMetadataReceived": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("uid", "number"), t.param("metadata", "string"), t.param("length", "number"))),
98
- "onExtensionEvent": t.opt(t.func("void", t.param("provider", "string"), t.param("extension", "string"), t.param("key", "string"), t.param("value", "string"))),
99
- "onExtensionStarted": t.opt(t.func("void", t.param("provider", "string"), t.param("extension", "string"))),
100
- "onExtensionStopped": t.opt(t.func("void", t.param("provider", "string"), t.param("extension", "string"))),
101
- "onExtensionError": t.opt(t.func("void", t.param("provider", "string"), t.param("extension", "string"), t.param("error", "number"), t.param("message", "string"))),
98
+ "onExtensionEventWithContext": t.opt(t.func("void", t.param("context", "ExtensionContext"), t.param("key", "string"), t.param("value", "string"))),
99
+ "onExtensionStartedWithContext": t.opt(t.func("void", t.param("context", "ExtensionContext"))),
100
+ "onExtensionStoppedWithContext": t.opt(t.func("void", t.param("context", "ExtensionContext"))),
101
+ "onExtensionErrorWithContext": t.opt(t.func("void", t.param("context", "ExtensionContext"), t.param("error", "number"), t.param("message", "string"))),
102
102
  "onSetRtmFlagResult": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("code", "number"))),
103
103
  });
104
104
 
@@ -1,10 +1,15 @@
1
1
  import { VideoMirrorModeType, VideoViewSetupMode } from '../Private/AgoraBase';
2
- import { RenderModeType, VideoSourceType } from '../Private/AgoraMediaBase';
2
+ import {
3
+ RenderModeType,
4
+ VideoModulePosition,
5
+ VideoSourceType,
6
+ } from '../Private/AgoraMediaBase';
3
7
  import { AgoraEnv } from '../Utils';
4
8
 
5
9
  const VIDEO_SOURCE_TYPE_STRING = 'video-source-type';
6
10
  const UID_STRING = 'uid';
7
11
  const CHANNEL_ID_STRING = 'channel-id';
12
+ const POSITION_STRING = 'position';
8
13
  const RENDERER_CONTENT_MODE_STRING = 'renderer-content-mode';
9
14
  const RENDERER_MIRROR_STRING = 'renderer-mirror';
10
15
 
@@ -12,6 +17,7 @@ const observedAttributes = [
12
17
  VIDEO_SOURCE_TYPE_STRING,
13
18
  UID_STRING,
14
19
  CHANNEL_ID_STRING,
20
+ POSITION_STRING,
15
21
  RENDERER_CONTENT_MODE_STRING,
16
22
  RENDERER_MIRROR_STRING,
17
23
  ];
@@ -19,7 +25,7 @@ const observedAttributes = [
19
25
  declare global {
20
26
  /**
21
27
  * Attributes of the Agora custom element.
22
- * You can use this custom element as follows:<agora-view video-source-type="{VideoSourceType.VideoSourceCamera}" channel-id="" uid="{0}"></agora-view>
28
+ * You can use this custom element as follows:<agora-view video-source-type="{VideoSourceType.VideoSourceCamera}" channel-id="" uid="{0}" position="{VideoModulePosition.PositionPreRenderer}"></agora-view>
23
29
  */
24
30
  interface AgoraView {
25
31
  /**
@@ -39,6 +45,10 @@ declare global {
39
45
  * "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "= ", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
40
46
  */
41
47
  'channel-id': string;
48
+ /**
49
+ * The frame position of the video observer.
50
+ */
51
+ 'position': VideoModulePosition;
42
52
  /**
43
53
  * The video display mode.
44
54
  */
@@ -109,6 +119,22 @@ export default class AgoraView extends HTMLElement {
109
119
  }
110
120
  }
111
121
 
122
+ get position(): VideoModulePosition {
123
+ const number = Number(this.getAttribute(POSITION_STRING));
124
+ return isNaN(number)
125
+ ? VideoModulePosition.PositionPreEncoder |
126
+ VideoModulePosition.PositionPreRenderer
127
+ : number;
128
+ }
129
+
130
+ set position(val) {
131
+ if (val) {
132
+ this.setAttribute(POSITION_STRING, String(val));
133
+ } else {
134
+ this.removeAttribute(POSITION_STRING);
135
+ }
136
+ }
137
+
112
138
  get renderMode(): RenderModeType {
113
139
  const number = Number(
114
140
  this.getAttribute(RENDERER_CONTENT_MODE_STRING) ||
@@ -142,12 +168,14 @@ export default class AgoraView extends HTMLElement {
142
168
  }
143
169
 
144
170
  initializeRender = () => {
145
- const { channelId, uid, sourceType, renderMode, renderMirror } = this;
171
+ const { channelId, uid, sourceType, position, renderMode, renderMirror } =
172
+ this;
146
173
  AgoraEnv.AgoraRendererManager?.addOrRemoveRenderer({
147
174
  sourceType,
148
175
  view: this,
149
176
  uid,
150
177
  channelId,
178
+ position,
151
179
  renderMode,
152
180
  mirrorMode: renderMirror
153
181
  ? VideoMirrorModeType.VideoMirrorModeEnabled
@@ -157,9 +185,10 @@ export default class AgoraView extends HTMLElement {
157
185
  };
158
186
 
159
187
  destroyRender = () => {
160
- const { channelId, uid, sourceType } = this;
188
+ const { channelId, uid, sourceType, position } = this;
161
189
  AgoraEnv.AgoraRendererManager?.removeRendererFromCache({
162
190
  channelId,
191
+ position,
163
192
  uid,
164
193
  sourceType,
165
194
  view: this,
@@ -45,8 +45,7 @@ export abstract class IRenderer {
45
45
 
46
46
  public drawFrame(_videoFrame?: VideoFrame): void {
47
47
  if (!this.canvas) return;
48
- //@ts-ignore
49
- if (!this.canvas.checkVisibility()) {
48
+ if (this.canvas.style.display !== '') {
50
49
  this.canvas.style.display = '';
51
50
  }
52
51
  }