agora-electron-sdk 4.2.6 → 4.3.0-dev.1

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 (172) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/js/Private/AgoraBase.js +139 -174
  3. package/js/Private/AgoraMediaBase.js +49 -20
  4. package/js/Private/AgoraMediaPlayerTypes.js +32 -23
  5. package/js/Private/IAgoraH265Transcoder.js +39 -0
  6. package/js/Private/IAgoraMediaStreamingSource.js +32 -32
  7. package/js/Private/IAgoraMusicContentCenter.js +19 -19
  8. package/js/Private/IAgoraRhythmPlayer.js +9 -9
  9. package/js/Private/IAgoraRtcEngine.js +12 -12
  10. package/js/Private/IAgoraSpatialAudio.js +3 -31
  11. package/js/Private/extension/IAgoraH265TranscoderExtension.js +2 -0
  12. package/js/Private/impl/AgoraMediaBaseImpl.js +26 -2
  13. package/js/Private/impl/IAgoraH265TranscoderImpl.js +119 -0
  14. package/js/Private/impl/IAgoraMediaEngineImpl.js +13 -13
  15. package/js/Private/impl/IAgoraMediaPlayerImpl.js +92 -74
  16. package/js/Private/impl/IAgoraMediaPlayerSourceImpl.js +12 -2
  17. package/js/Private/impl/IAgoraMediaRecorderImpl.js +2 -2
  18. package/js/Private/impl/IAgoraMusicContentCenterImpl.js +20 -20
  19. package/js/Private/impl/IAgoraRtcEngineExImpl.js +66 -84
  20. package/js/Private/impl/IAgoraRtcEngineImpl.js +456 -440
  21. package/js/Private/impl/IAgoraSpatialAudioImpl.js +157 -181
  22. package/js/Private/impl/IAudioDeviceManagerImpl.js +22 -22
  23. package/js/Private/internal/AgoraH265TranscoderInternal.js +86 -0
  24. package/js/Private/internal/AgoraMediaBaseInternal.js +34 -0
  25. package/js/Private/internal/IrisApiEngine.js +35 -20
  26. package/js/Private/internal/LocalSpatialAudioEngineInternal.js +0 -39
  27. package/js/Private/internal/MediaPlayerInternal.js +22 -21
  28. package/js/Private/internal/MusicContentCenterInternal.js +1 -4
  29. package/js/Private/internal/RtcEngineExInternal.js +101 -134
  30. package/js/Private/ti/AgoraMediaBase-ti.js +1 -1
  31. package/js/Private/ti/IAgoraH265Transcoder-ti.js +40 -0
  32. package/js/Private/ti/IAgoraMediaPlayerSource-ti.js +4 -2
  33. package/js/Private/ti/IAgoraMusicContentCenter-ti.js +5 -5
  34. package/js/Private/ti/IAgoraRtcEngine-ti.js +12 -11
  35. package/js/Renderer/AgoraView.js +28 -14
  36. package/js/Renderer/IRenderer.js +65 -17
  37. package/js/Renderer/IRendererManager.js +230 -0
  38. package/js/Renderer/RendererCache.js +170 -0
  39. package/js/Renderer/RendererManager.js +49 -460
  40. package/js/Renderer/WebGLRenderer/index.js +82 -234
  41. package/js/Renderer/YUVCanvasRenderer/index.js +27 -147
  42. package/js/Types.js +6 -6
  43. package/js/Utils.js +37 -88
  44. package/package.json +4 -3
  45. package/scripts/clean.js +12 -0
  46. package/scripts/synclib.js +8 -2
  47. package/ts/Private/AgoraBase.ts +225 -201
  48. package/ts/Private/AgoraMediaBase.ts +63 -25
  49. package/ts/Private/AgoraMediaPlayerTypes.ts +67 -24
  50. package/ts/Private/IAgoraH265Transcoder.ts +73 -0
  51. package/ts/Private/IAgoraLog.ts +1 -0
  52. package/ts/Private/IAgoraMediaEngine.ts +12 -7
  53. package/ts/Private/IAgoraMediaPlayer.ts +47 -21
  54. package/ts/Private/IAgoraMediaPlayerSource.ts +27 -6
  55. package/ts/Private/IAgoraMediaStreamingSource.ts +38 -37
  56. package/ts/Private/IAgoraMusicContentCenter.ts +20 -20
  57. package/ts/Private/IAgoraRhythmPlayer.ts +7 -6
  58. package/ts/Private/IAgoraRtcEngine.ts +407 -364
  59. package/ts/Private/IAgoraRtcEngineEx.ts +25 -61
  60. package/ts/Private/IAgoraSpatialAudio.ts +80 -191
  61. package/ts/Private/IAudioDeviceManager.ts +27 -14
  62. package/ts/Private/extension/IAgoraH265TranscoderExtension.ts +39 -0
  63. package/ts/Private/impl/AgoraMediaBaseImpl.ts +25 -1
  64. package/ts/Private/impl/IAgoraH265TranscoderImpl.ts +152 -0
  65. package/ts/Private/impl/IAgoraMediaEngineImpl.ts +13 -13
  66. package/ts/Private/impl/IAgoraMediaPlayerImpl.ts +110 -81
  67. package/ts/Private/impl/IAgoraMediaPlayerSourceImpl.ts +17 -2
  68. package/ts/Private/impl/IAgoraMediaRecorderImpl.ts +2 -2
  69. package/ts/Private/impl/IAgoraMusicContentCenterImpl.ts +21 -21
  70. package/ts/Private/impl/IAgoraRtcEngineExImpl.ts +71 -106
  71. package/ts/Private/impl/IAgoraRtcEngineImpl.ts +589 -572
  72. package/ts/Private/impl/IAgoraSpatialAudioImpl.ts +211 -218
  73. package/ts/Private/impl/IAudioDeviceManagerImpl.ts +22 -22
  74. package/ts/Private/internal/AgoraH265TranscoderInternal.ts +97 -0
  75. package/ts/Private/internal/AgoraMediaBaseInternal.ts +15 -0
  76. package/ts/Private/internal/IrisApiEngine.ts +42 -27
  77. package/ts/Private/internal/LocalSpatialAudioEngineInternal.ts +1 -86
  78. package/ts/Private/internal/MediaPlayerInternal.ts +20 -29
  79. package/ts/Private/internal/MusicContentCenterInternal.ts +1 -5
  80. package/ts/Private/internal/RtcEngineExInternal.ts +91 -204
  81. package/ts/Private/ti/AgoraMediaBase-ti.ts +1 -1
  82. package/ts/Private/ti/IAgoraH265Transcoder-ti.ts +16 -0
  83. package/ts/Private/ti/IAgoraMediaPlayerSource-ti.ts +4 -2
  84. package/ts/Private/ti/IAgoraMusicContentCenter-ti.ts +5 -5
  85. package/ts/Private/ti/IAgoraRtcEngine-ti.ts +12 -11
  86. package/ts/Renderer/AgoraView.ts +29 -19
  87. package/ts/Renderer/IRenderer.ts +71 -22
  88. package/ts/Renderer/IRendererManager.ts +273 -19
  89. package/ts/Renderer/RendererCache.ts +167 -0
  90. package/ts/Renderer/RendererManager.ts +62 -607
  91. package/ts/Renderer/WebGLRenderer/index.ts +117 -295
  92. package/ts/Renderer/YUVCanvasRenderer/index.ts +45 -198
  93. package/ts/Types.ts +17 -194
  94. package/ts/Utils.ts +36 -100
  95. package/types/Private/AgoraBase.d.ts +219 -200
  96. package/types/Private/AgoraBase.d.ts.map +1 -1
  97. package/types/Private/AgoraMediaBase.d.ts +63 -27
  98. package/types/Private/AgoraMediaBase.d.ts.map +1 -1
  99. package/types/Private/AgoraMediaPlayerTypes.d.ts +65 -24
  100. package/types/Private/AgoraMediaPlayerTypes.d.ts.map +1 -1
  101. package/types/Private/IAgoraH265Transcoder.d.ts +28 -0
  102. package/types/Private/IAgoraH265Transcoder.d.ts.map +1 -0
  103. package/types/Private/IAgoraLog.d.ts.map +1 -1
  104. package/types/Private/IAgoraMediaEngine.d.ts +11 -6
  105. package/types/Private/IAgoraMediaEngine.d.ts.map +1 -1
  106. package/types/Private/IAgoraMediaPlayer.d.ts +42 -20
  107. package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -1
  108. package/types/Private/IAgoraMediaPlayerSource.d.ts +23 -6
  109. package/types/Private/IAgoraMediaPlayerSource.d.ts.map +1 -1
  110. package/types/Private/IAgoraMediaStreamingSource.d.ts.map +1 -1
  111. package/types/Private/IAgoraMusicContentCenter.d.ts +19 -19
  112. package/types/Private/IAgoraMusicContentCenter.d.ts.map +1 -1
  113. package/types/Private/IAgoraRhythmPlayer.d.ts +6 -6
  114. package/types/Private/IAgoraRhythmPlayer.d.ts.map +1 -1
  115. package/types/Private/IAgoraRtcEngine.d.ts +329 -293
  116. package/types/Private/IAgoraRtcEngine.d.ts.map +1 -1
  117. package/types/Private/IAgoraRtcEngineEx.d.ts +21 -53
  118. package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -1
  119. package/types/Private/IAgoraSpatialAudio.d.ts +56 -167
  120. package/types/Private/IAgoraSpatialAudio.d.ts.map +1 -1
  121. package/types/Private/IAudioDeviceManager.d.ts +27 -14
  122. package/types/Private/IAudioDeviceManager.d.ts.map +1 -1
  123. package/types/Private/extension/IAgoraH265TranscoderExtension.d.ts +24 -0
  124. package/types/Private/extension/IAgoraH265TranscoderExtension.d.ts.map +1 -0
  125. package/types/Private/impl/AgoraMediaBaseImpl.d.ts +5 -1
  126. package/types/Private/impl/AgoraMediaBaseImpl.d.ts.map +1 -1
  127. package/types/Private/impl/IAgoraH265TranscoderImpl.d.ts +15 -0
  128. package/types/Private/impl/IAgoraH265TranscoderImpl.d.ts.map +1 -0
  129. package/types/Private/impl/IAgoraMediaPlayerImpl.d.ts +6 -4
  130. package/types/Private/impl/IAgoraMediaPlayerImpl.d.ts.map +1 -1
  131. package/types/Private/impl/IAgoraMediaPlayerSourceImpl.d.ts.map +1 -1
  132. package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts +2 -4
  133. package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts.map +1 -1
  134. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +30 -25
  135. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -1
  136. package/types/Private/impl/IAgoraSpatialAudioImpl.d.ts +20 -22
  137. package/types/Private/impl/IAgoraSpatialAudioImpl.d.ts.map +1 -1
  138. package/types/Private/internal/AgoraH265TranscoderInternal.d.ts +14 -0
  139. package/types/Private/internal/AgoraH265TranscoderInternal.d.ts.map +1 -0
  140. package/types/Private/internal/AgoraMediaBaseInternal.d.ts +8 -0
  141. package/types/Private/internal/AgoraMediaBaseInternal.d.ts.map +1 -0
  142. package/types/Private/internal/IrisApiEngine.d.ts +5 -2
  143. package/types/Private/internal/IrisApiEngine.d.ts.map +1 -1
  144. package/types/Private/internal/LocalSpatialAudioEngineInternal.d.ts +0 -15
  145. package/types/Private/internal/LocalSpatialAudioEngineInternal.d.ts.map +1 -1
  146. package/types/Private/internal/MediaPlayerInternal.d.ts.map +1 -1
  147. package/types/Private/internal/MusicContentCenterInternal.d.ts +0 -1
  148. package/types/Private/internal/MusicContentCenterInternal.d.ts.map +1 -1
  149. package/types/Private/internal/RtcEngineExInternal.d.ts +7 -13
  150. package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -1
  151. package/types/Private/ti/IAgoraH265Transcoder-ti.d.ts +8 -0
  152. package/types/Private/ti/IAgoraH265Transcoder-ti.d.ts.map +1 -0
  153. package/types/Private/ti/IAgoraMediaPlayerSource-ti.d.ts.map +1 -1
  154. package/types/Private/ti/IAgoraRtcEngine-ti.d.ts.map +1 -1
  155. package/types/Renderer/AgoraView.d.ts +4 -4
  156. package/types/Renderer/AgoraView.d.ts.map +1 -1
  157. package/types/Renderer/IRenderer.d.ts +11 -9
  158. package/types/Renderer/IRenderer.d.ts.map +1 -1
  159. package/types/Renderer/IRendererManager.d.ts +50 -12
  160. package/types/Renderer/IRendererManager.d.ts.map +1 -1
  161. package/types/Renderer/RendererCache.d.ts +36 -0
  162. package/types/Renderer/RendererCache.d.ts.map +1 -0
  163. package/types/Renderer/RendererManager.d.ts +13 -139
  164. package/types/Renderer/RendererManager.d.ts.map +1 -1
  165. package/types/Renderer/WebGLRenderer/index.d.ts +3 -18
  166. package/types/Renderer/WebGLRenderer/index.d.ts.map +1 -1
  167. package/types/Renderer/YUVCanvasRenderer/index.d.ts +4 -10
  168. package/types/Renderer/YUVCanvasRenderer/index.d.ts.map +1 -1
  169. package/types/Types.d.ts +11 -187
  170. package/types/Types.d.ts.map +1 -1
  171. package/types/Utils.d.ts +3 -20
  172. package/types/Utils.d.ts.map +1 -1
@@ -108,9 +108,9 @@ export enum AudioRoute {
108
108
  */
109
109
  RouteLoudspeaker = 4,
110
110
  /**
111
- * @ignore
111
+ * 5: The audio route is a Bluetooth device using the HFP protocol.
112
112
  */
113
- RouteHeadsetbluetooth = 5,
113
+ RouteBluetoothDeviceHfp = 5,
114
114
  /**
115
115
  * 7: The audio route is a USB peripheral device. (For macOS only)
116
116
  */
@@ -127,6 +127,10 @@ export enum AudioRoute {
127
127
  * 9: The audio route is Apple AirPlay. (For macOS only)
128
128
  */
129
129
  RouteAirplay = 9,
130
+ /**
131
+ * 10: The audio route is a Bluetooth device using the A2DP protocol.
132
+ */
133
+ RouteBluetoothDeviceA2dp = 10,
130
134
  }
131
135
 
132
136
  /**
@@ -188,7 +192,7 @@ export enum MediaSourceType {
188
192
  */
189
193
  PrimaryCameraSource = 2,
190
194
  /**
191
- * 3: The secondary camera.
195
+ * 3: A secondary camera.
192
196
  */
193
197
  SecondaryCameraSource = 3,
194
198
  /**
@@ -200,7 +204,7 @@ export enum MediaSourceType {
200
204
  */
201
205
  SecondaryScreenSource = 5,
202
206
  /**
203
- * @ignore
207
+ * 6. Custom video source.
204
208
  */
205
209
  CustomVideoSource = 6,
206
210
  /**
@@ -483,6 +487,26 @@ export enum CameraVideoSourceType {
483
487
  VideoSourceUnspecified = 2,
484
488
  }
485
489
 
490
+ /**
491
+ * @ignore
492
+ */
493
+ export enum MetaInfoKey {
494
+ /**
495
+ * @ignore
496
+ */
497
+ KeyFaceCapture = 0,
498
+ }
499
+
500
+ /**
501
+ * @ignore
502
+ */
503
+ export abstract class IVideoFrameMetaInfo {
504
+ /**
505
+ * @ignore
506
+ */
507
+ abstract getMetaInfoStr(key: MetaInfoKey): string;
508
+ }
509
+
486
510
  /**
487
511
  * @ignore
488
512
  */
@@ -671,6 +695,10 @@ export class VideoFrame {
671
695
  * @ignore
672
696
  */
673
697
  pixelBuffer?: Uint8Array;
698
+ /**
699
+ * The meta information in the video frame. To use this parameter, please.
700
+ */
701
+ metaInfo?: IVideoFrameMetaInfo;
674
702
  }
675
703
 
676
704
  /**
@@ -696,7 +724,7 @@ export enum MediaPlayerSourceType {
696
724
  */
697
725
  export enum VideoModulePosition {
698
726
  /**
699
- * 1: The post-capturer position, which corresponds to the video data in the onCaptureVideoFrame callback.
727
+ * 1: The location of the locally collected video data after preprocessing corresponds to the onCaptureVideoFrame callback. The observed video here has the effect of video pre-processing, which can be verified by enabling image enhancement, virtual background, or watermark.
700
728
  */
701
729
  PositionPostCapturer = 1 << 0,
702
730
  /**
@@ -704,9 +732,15 @@ export enum VideoModulePosition {
704
732
  */
705
733
  PositionPreRenderer = 1 << 1,
706
734
  /**
707
- * 4: The pre-encoder position, which corresponds to the video data in the onPreEncodeVideoFrame callback.
735
+ * 4: The pre-encoder position, which corresponds to the video data in the onPreEncodeVideoFrame callback. The observed video here has the effects of video pre-processing and encoding pre-processing.
736
+ * To verify the pre-processing effects of the video, you can enable image enhancement, virtual background, or watermark.
737
+ * To verify the pre-encoding processing effect, you can set a lower frame rate (for example, 5 fps).
708
738
  */
709
739
  PositionPreEncoder = 1 << 2,
740
+ /**
741
+ * 8: The position after local video capture and before pre-processing. The observed video here does not have pre-processing effects, which can be verified by enabling image enhancement, virtual background, or watermarks.
742
+ */
743
+ PositionPostCapturerOrigin = 1 << 3,
710
744
  }
711
745
 
712
746
  /**
@@ -777,6 +811,10 @@ export class AudioFrame {
777
811
  * @ignore
778
812
  */
779
813
  presentationMs?: number;
814
+ /**
815
+ * @ignore
816
+ */
817
+ audioTrackNumber?: number;
780
818
  }
781
819
 
782
820
  /**
@@ -1027,13 +1065,13 @@ export interface IVideoFrameObserver {
1027
1065
  * Occurs each time the SDK receives a video frame captured by local devices.
1028
1066
  *
1029
1067
  * After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame. In this callback, you can get the video data captured by local devices. You can then pre-process the data according to your scenarios. Once the pre-processing is complete, you can directly modify videoFrame in this callback, and set the return value to true to send the modified video data to the SDK.
1030
- * The video data that this callback gets has not been pre-processed, and is not watermarked, cropped, rotated or beautified.
1068
+ * The video data that this callback gets has not been pre-processed such as watermarking, cropping, and rotating.
1031
1069
  * If the video data type you get is RGBA, the SDK does not support processing the data of the alpha channel.
1032
1070
  *
1033
1071
  * @param sourceType Video source types, including cameras, screens, or media player. See VideoSourceType.
1034
1072
  * @param videoFrame The video frame. See VideoFrame. The default value of the video frame data format obtained through this callback is as follows:
1035
- * macOS: YUV 420
1036
- * Windows: YUV 420
1073
+ * macOS: I420 or CVPixelBufferRef
1074
+ * Windows: YUV420
1037
1075
  *
1038
1076
  * @returns
1039
1077
  * When the video processing mode is ProcessModeReadOnly : true : Reserved for future use. false : Reserved for future use.
@@ -1052,8 +1090,8 @@ export interface IVideoFrameObserver {
1052
1090
  *
1053
1091
  * @param sourceType The type of the video source. See VideoSourceType.
1054
1092
  * @param videoFrame The video frame. See VideoFrame. The default value of the video frame data format obtained through this callback is as follows:
1055
- * macOS: YUV 420
1056
- * Windows: YUV 420
1093
+ * macOS: I420 or CVPixelBufferRef
1094
+ * Windows: YUV420
1057
1095
  *
1058
1096
  * @returns
1059
1097
  * When the video processing mode is ProcessModeReadOnly : true : Reserved for future use. false : Reserved for future use.
@@ -1078,8 +1116,8 @@ export interface IVideoFrameObserver {
1078
1116
  * @param channelId The channel ID.
1079
1117
  * @param remoteUid The user ID of the remote user who sends the current video frame.
1080
1118
  * @param videoFrame The video frame. See VideoFrame. The default value of the video frame data format obtained through this callback is as follows:
1081
- * macOS: YUV 420
1082
- * Windows: YUV 420
1119
+ * macOS: I420 or CVPixelBufferRef
1120
+ * Windows: YUV420
1083
1121
  *
1084
1122
  * @returns
1085
1123
  * When the video processing mode is ProcessModeReadOnly : true : Reserved for future use. false : Reserved for future use.
@@ -1144,7 +1182,7 @@ export enum MediaRecorderStreamType {
1144
1182
  */
1145
1183
  export enum RecorderState {
1146
1184
  /**
1147
- * -1: An error occurs during the recording. See RecorderErrorCode for the reason.
1185
+ * -1: An error occurs during the recording. See RecorderReasonCode for the reason.
1148
1186
  */
1149
1187
  RecorderStateError = -1,
1150
1188
  /**
@@ -1160,27 +1198,27 @@ export enum RecorderState {
1160
1198
  /**
1161
1199
  * The reason for the state change.
1162
1200
  */
1163
- export enum RecorderErrorCode {
1201
+ export enum RecorderReasonCode {
1164
1202
  /**
1165
1203
  * 0: No error.
1166
1204
  */
1167
- RecorderErrorNone = 0,
1205
+ RecorderReasonNone = 0,
1168
1206
  /**
1169
- * 1: The SDK fails to write the recorded data to a file.
1207
+ * @ignore
1170
1208
  */
1171
- RecorderErrorWriteFailed = 1,
1209
+ RecorderReasonWriteFailed = 1,
1172
1210
  /**
1173
- * 2: The SDK does not detect any audio and video streams, or audio and video streams are interrupted for more than five seconds during recording.
1211
+ * @ignore
1174
1212
  */
1175
- RecorderErrorNoStream = 2,
1213
+ RecorderReasonNoStream = 2,
1176
1214
  /**
1177
- * 3: The recording duration exceeds the upper limit.
1215
+ * @ignore
1178
1216
  */
1179
- RecorderErrorOverMaxDuration = 3,
1217
+ RecorderReasonOverMaxDuration = 3,
1180
1218
  /**
1181
- * 4: The recording configuration changes.
1219
+ * @ignore
1182
1220
  */
1183
- RecorderErrorConfigChanged = 4,
1221
+ RecorderReasonConfigChanged = 4,
1184
1222
  }
1185
1223
 
1186
1224
  /**
@@ -1238,7 +1276,7 @@ export interface IMediaRecorderObserver {
1238
1276
  channelId: string,
1239
1277
  uid: number,
1240
1278
  state: RecorderState,
1241
- error: RecorderErrorCode
1279
+ reason: RecorderReasonCode
1242
1280
  ): void;
1243
1281
 
1244
1282
  /**
@@ -1,4 +1,5 @@
1
1
  import './extension/AgoraMediaPlayerTypesExtension';
2
+
2
3
  /**
3
4
  * The playback state.
4
5
  */
@@ -70,81 +71,81 @@ export enum MediaPlayerState {
70
71
  }
71
72
 
72
73
  /**
73
- * Error codes of the media player.
74
+ * Reasons for the changes in the media player status.
74
75
  */
75
- export enum MediaPlayerError {
76
+ export enum MediaPlayerReason {
76
77
  /**
77
78
  * 0: No error.
78
79
  */
79
- PlayerErrorNone = 0,
80
+ PlayerReasonNone = 0,
80
81
  /**
81
82
  * -1: Invalid arguments.
82
83
  */
83
- PlayerErrorInvalidArguments = -1,
84
+ PlayerReasonInvalidArguments = -1,
84
85
  /**
85
86
  * -2: Internal error.
86
87
  */
87
- PlayerErrorInternal = -2,
88
+ PlayerReasonInternal = -2,
88
89
  /**
89
90
  * -3: No resource.
90
91
  */
91
- PlayerErrorNoResource = -3,
92
+ PlayerReasonNoResource = -3,
92
93
  /**
93
94
  * -4: Invalid media resource.
94
95
  */
95
- PlayerErrorInvalidMediaSource = -4,
96
+ PlayerReasonInvalidMediaSource = -4,
96
97
  /**
97
98
  * -5: The media stream type is unknown.
98
99
  */
99
- PlayerErrorUnknownStreamType = -5,
100
+ PlayerReasonUnknownStreamType = -5,
100
101
  /**
101
102
  * -6: The object is not initialized.
102
103
  */
103
- PlayerErrorObjNotInitialized = -6,
104
+ PlayerReasonObjNotInitialized = -6,
104
105
  /**
105
106
  * -7: The codec is not supported.
106
107
  */
107
- PlayerErrorCodecNotSupported = -7,
108
+ PlayerReasonCodecNotSupported = -7,
108
109
  /**
109
110
  * -8: Invalid renderer.
110
111
  */
111
- PlayerErrorVideoRenderFailed = -8,
112
+ PlayerReasonVideoRenderFailed = -8,
112
113
  /**
113
114
  * -9: An error with the internal state of the player occurs.
114
115
  */
115
- PlayerErrorInvalidState = -9,
116
+ PlayerReasonInvalidState = -9,
116
117
  /**
117
118
  * -10: The URL of the media resource cannot be found.
118
119
  */
119
- PlayerErrorUrlNotFound = -10,
120
+ PlayerReasonUrlNotFound = -10,
120
121
  /**
121
122
  * -11: Invalid connection between the player and the Agora Server.
122
123
  */
123
- PlayerErrorInvalidConnectionState = -11,
124
+ PlayerReasonInvalidConnectionState = -11,
124
125
  /**
125
126
  * -12: The playback buffer is insufficient.
126
127
  */
127
- PlayerErrorSrcBufferUnderflow = -12,
128
+ PlayerReasonSrcBufferUnderflow = -12,
128
129
  /**
129
130
  * -13: The playback is interrupted.
130
131
  */
131
- PlayerErrorInterrupted = -13,
132
+ PlayerReasonInterrupted = -13,
132
133
  /**
133
134
  * -14: The SDK does not support the method being called.
134
135
  */
135
- PlayerErrorNotSupported = -14,
136
+ PlayerReasonNotSupported = -14,
136
137
  /**
137
138
  * @ignore
138
139
  */
139
- PlayerErrorTokenExpired = -15,
140
+ PlayerReasonTokenExpired = -15,
140
141
  /**
141
142
  * @ignore
142
143
  */
143
- PlayerErrorIpExpired = -16,
144
+ PlayerReasonIpExpired = -16,
144
145
  /**
145
146
  * -17: An unknown error.
146
147
  */
147
- PlayerErrorUnknown = -17,
148
+ PlayerReasonUnknown = -17,
148
149
  }
149
150
 
150
151
  /**
@@ -365,22 +366,60 @@ export class CacheStatistics {
365
366
  downloadSize?: number;
366
367
  }
367
368
 
369
+ /**
370
+ * The information of the media file being played.
371
+ */
372
+ export class PlayerPlaybackStats {
373
+ /**
374
+ * The frame rate (fps) of the video.
375
+ */
376
+ videoFps?: number;
377
+ /**
378
+ * The bitrate (kbps) of the video.
379
+ */
380
+ videoBitrateInKbps?: number;
381
+ /**
382
+ * The bitrate (kbps) of the audio.
383
+ */
384
+ audioBitrateInKbps?: number;
385
+ /**
386
+ * The total bitrate (kbps) of the media stream.
387
+ */
388
+ totalBitrateInKbps?: number;
389
+ }
390
+
368
391
  /**
369
392
  * Information related to the media player.
370
393
  */
371
394
  export class PlayerUpdatedInfo {
372
395
  /**
373
- * The ID of a media player.
396
+ * @ignore
374
397
  */
375
- playerId?: string;
398
+ internalPlayerUuid?: string;
376
399
  /**
377
400
  * The ID of a deivce.
378
401
  */
379
402
  deviceId?: string;
380
403
  /**
381
- * The statistics about the media file being cached. If you call the openWithMediaSource method and set enableCache as true, the statistics about the media file being cached is updated every second after the media file is played. See CacheStatistics.
404
+ * Height (pixel) of the video.
382
405
  */
383
- cacheStatistics?: CacheStatistics;
406
+ videoHeight?: number;
407
+ /**
408
+ * Width (pixel) of the video.
409
+ */
410
+ videoWidth?: number;
411
+ /**
412
+ * Audio sample rate (Hz).
413
+ */
414
+ audioSampleRate?: number;
415
+ /**
416
+ * The number of audio channels.
417
+ */
418
+ audioChannels?: number;
419
+ /**
420
+ * The number of bits per audio sample point.
421
+ */
422
+ audioBitsPerSample?: number;
384
423
  }
385
424
 
386
425
  /**
@@ -410,6 +449,10 @@ export class MediaSource {
410
449
  * If you enable this function, the Media Player caches part of the media file being played on your local device, and you can play the cached media file without internet connection. The statistics about the media file being cached are updated every second after the media file is played. See CacheStatistics.
411
450
  */
412
451
  enableCache?: boolean;
452
+ /**
453
+ * Whether to allow the selection of different audio tracks when playing this media file: true : Allow to select different audio tracks. false : (Default) Do not allow to select different audio tracks. If you need to set different audio tracks for local playback and publishing to the channel, you need to set this parameter to true, and then call the selectMultiAudioTrack method to select the audio track.
454
+ */
455
+ enableMultiAudioTrack?: boolean;
413
456
  /**
414
457
  * Whether the media resource to be opened is a live stream or on-demand video distributed through Media Broadcast service: true : The media resource to be played is a live or on-demand video distributed through Media Broadcast service. false : (Default) The media resource is not a live stream or on-demand video distributed through Media Broadcast service. If you need to open a live stream or on-demand video distributed through Broadcast Streaming service, pass in the URL of the media resource to url, and set isAgoraSource as true; otherwise, you don't need to set the isAgoraSource parameter.
415
458
  */
@@ -0,0 +1,73 @@
1
+ import './extension/IAgoraH265TranscoderExtension';
2
+
3
+ /* enum_H265TranscodeResult */
4
+ export enum H265TranscodeResult {
5
+ /* enum_H265TranscodeResult_H265TranscodeResultUnknown */
6
+ H265TranscodeResultUnknown = -1,
7
+ /* enum_H265TranscodeResult_H265TranscodeResultSuccess */
8
+ H265TranscodeResultSuccess = 0,
9
+ /* enum_H265TranscodeResult_H265TranscodeResultRequestInvalid */
10
+ H265TranscodeResultRequestInvalid = 1,
11
+ /* enum_H265TranscodeResult_H265TranscodeResultUnauthorized */
12
+ H265TranscodeResultUnauthorized = 2,
13
+ /* enum_H265TranscodeResult_H265TranscodeResultTokenExpired */
14
+ H265TranscodeResultTokenExpired = 3,
15
+ /* enum_H265TranscodeResult_H265TranscodeResultForbidden */
16
+ H265TranscodeResultForbidden = 4,
17
+ /* enum_H265TranscodeResult_H265TranscodeResultNotFound */
18
+ H265TranscodeResultNotFound = 5,
19
+ /* enum_H265TranscodeResult_H265TranscodeResultConflicted */
20
+ H265TranscodeResultConflicted = 6,
21
+ /* enum_H265TranscodeResult_H265TranscodeResultNotSupported */
22
+ H265TranscodeResultNotSupported = 7,
23
+ /* enum_H265TranscodeResult_H265TranscodeResultTooOften */
24
+ H265TranscodeResultTooOften = 8,
25
+ /* enum_H265TranscodeResult_H265TranscodeResultServerInternalError */
26
+ H265TranscodeResultServerInternalError = 9,
27
+ /* enum_H265TranscodeResult_H265TranscodeResultServiceUnavailable */
28
+ H265TranscodeResultServiceUnavailable = 10,
29
+ }
30
+
31
+ /* class_IH265TranscoderObserver */
32
+ export interface IH265TranscoderObserver {
33
+ /* callback_IH265TranscoderObserver_onEnableTranscode */
34
+
35
+ onEnableTranscode?(result: H265TranscodeResult): void;
36
+ /* callback_IH265TranscoderObserver_onQueryChannel */
37
+
38
+ onQueryChannel?(
39
+ result: H265TranscodeResult,
40
+ originChannel: string,
41
+ transcodeChannel: string
42
+ ): void;
43
+ /* callback_IH265TranscoderObserver_onTriggerTranscode */
44
+
45
+ onTriggerTranscode?(result: H265TranscodeResult): void;
46
+ }
47
+
48
+ /* class_IH265Transcoder */
49
+ export abstract class IH265Transcoder {
50
+ /* api_IH265Transcoder_enableTranscode */
51
+
52
+ abstract enableTranscode(token: string, channel: string, uid: number): number;
53
+ /* api_IH265Transcoder_queryChannel */
54
+
55
+ abstract queryChannel(token: string, channel: string, uid: number): number;
56
+ /* api_IH265Transcoder_triggerTranscode */
57
+
58
+ abstract triggerTranscode(
59
+ token: string,
60
+ channel: string,
61
+ uid: number
62
+ ): number;
63
+ /* api_IH265Transcoder_registerTranscoderObserver */
64
+
65
+ abstract registerTranscoderObserver(
66
+ observer: IH265TranscoderObserver
67
+ ): number;
68
+ /* api_IH265Transcoder_unregisterTranscoderObserver */
69
+
70
+ abstract unregisterTranscoderObserver(
71
+ observer: IH265TranscoderObserver
72
+ ): number;
73
+ }
@@ -1,4 +1,5 @@
1
1
  import './extension/IAgoraLogExtension';
2
+
2
3
  /**
3
4
  * The output log level of the SDK.
4
5
  */
@@ -113,7 +113,7 @@ export abstract class IMediaEngine {
113
113
  /**
114
114
  * Pulls the remote audio data.
115
115
  *
116
- * Before calling this method, you need to call setExternalAudioSink to notify the app to enable and set the external rendering. After a successful method call, the app pulls the decoded and mixed audio data for playback.
116
+ * Before calling this method, you need to call setExternalAudioSink to notify the app to enable and set the external rendering. After a successful call of this method, the app pulls the decoded and mixed audio data for playback.
117
117
  * This method only supports pulling data from custom audio source. If you need to pull the data captured by the SDK, do not call this method.
118
118
  * Call this method after joining a channel.
119
119
  * Once you enable the external audio sink, the app will not retrieve any audio data from the onPlaybackAudioFrame callback.
@@ -174,10 +174,10 @@ export abstract class IMediaEngine {
174
174
  /**
175
175
  * Creates a custom audio track.
176
176
  *
177
- * To publish a custom audio source to multiple channels, see the following steps:
177
+ * Ensure that you call this method before joining a channel. To publish a custom audio source, see the following steps:
178
178
  * Call this method to create a custom audio track and get the audio track ID.
179
- * In ChannelMediaOptions of each channel, set publishCustomAduioTrackId to the audio track ID that you want to publish, and set publishCustomAudioTrack to true.
180
- * If you call pushAudioFrame, and specify trackId as the audio track ID set in step 2, you can publish the corresponding custom audio source in multiple channels.
179
+ * Call joinChannel to join the channel. In ChannelMediaOptions, set publishCustomAduioTrackId to the audio track ID that you want to publish, and set publishCustomAudioTrack to true.
180
+ * Call pushAudioFrame and specify trackId as the audio track ID set in step 2. You can then publish the corresponding custom audio source in the channel.
181
181
  *
182
182
  * @param trackType The type of the custom audio track. See AudioTrackType. If AudioTrackDirect is specified for this parameter, you must set publishMicrophoneTrack to false in ChannelMediaOptions when calling joinChannel to join the channel; otherwise, joining the channel fails and returns the error code -2.
183
183
  * @param config The configuration of the custom audio track. See AudioTrackConfig.
@@ -232,9 +232,14 @@ export abstract class IMediaEngine {
232
232
  ): number;
233
233
 
234
234
  /**
235
- * Pushes the external raw video frame to the SDK.
236
- *
237
- * If you call createCustomVideoTrack method to get the video track ID, set the customVideoTrackId parameter to the video track ID you want to publish in the ChannelMediaOptions of each channel, and set the publishCustomVideoTrack parameter to true, you can call this method to push the unencoded external video frame to the SDK.
235
+ * Pushes the external raw video frame to the SDK through video tracks.
236
+ *
237
+ * To publish a custom video source, see the following steps:
238
+ * Call createCustomVideoTrack to create a video track and get the video track ID.
239
+ * Call joinChannel to join the channel. In ChannelMediaOptions, set customVideoTrackId to the video track ID that you want to publish, and set publishCustomVideoTrack to true.
240
+ * Call this method and specify videoTrackId as the video track ID set in step 2. You can then publish the corresponding custom video source in the channel. After calling this method, even if you stop pushing external video frames to the SDK, the custom video stream will still be counted as the video duration usage and incur charges. Agora recommends that you take appropriate measures based on the actual situation to avoid such video billing.
241
+ * If you no longer need to capture external video data, you can call destroyCustomVideoTrack to destroy the custom video track.
242
+ * If you only want to use the external video data for local preview and not publish it in the channel, you can call muteLocalVideoStream to cancel sending video stream or call updateChannelMediaOptions to set publishCustomVideoTrack to false.
238
243
  *
239
244
  * @param frame The external raw video frame to be pushed. See ExternalVideoFrame.
240
245
  * @param videoTrackId The video track ID returned by calling the createCustomVideoTrack method. The default value is 0.