agora-electron-sdk 4.2.2-dev.4 → 4.2.2-dev.7

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 (67) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/js/Private/AgoraBase.js +139 -53
  3. package/js/Private/AgoraMediaBase.js +13 -7
  4. package/js/Private/IAgoraRtcEngine.js +11 -11
  5. package/js/Private/IAgoraRtcEngineEx.js +1 -1
  6. package/js/Private/IAgoraSpatialAudio.js +2 -2
  7. package/js/Private/impl/IAgoraMediaEngineImpl.js +12 -6
  8. package/js/Private/impl/IAgoraRtcEngineImpl.js +7 -7
  9. package/js/Private/internal/IrisApiEngine.js +13 -0
  10. package/js/Private/internal/MusicContentCenterInternal.js +3 -0
  11. package/js/Private/internal/RtcEngineExInternal.js +24 -7
  12. package/js/Private/ti/IAgoraRtcEngine-ti.js +2 -2
  13. package/js/Renderer/WebGLRenderer/index.js +19 -19
  14. package/js/Renderer/YUVCanvasRenderer/index.js +1 -1
  15. package/package.json +3 -3
  16. package/scripts/zipBuild.js +3 -1
  17. package/ts/Private/AgoraBase.ts +296 -133
  18. package/ts/Private/AgoraMediaBase.ts +68 -34
  19. package/ts/Private/AgoraMediaPlayerTypes.ts +8 -5
  20. package/ts/Private/IAgoraLog.ts +7 -3
  21. package/ts/Private/IAgoraMediaEngine.ts +76 -35
  22. package/ts/Private/IAgoraMediaPlayer.ts +126 -64
  23. package/ts/Private/IAgoraMediaPlayerSource.ts +3 -1
  24. package/ts/Private/IAgoraRtcEngine.ts +1325 -530
  25. package/ts/Private/IAgoraRtcEngineEx.ts +227 -94
  26. package/ts/Private/IAgoraSpatialAudio.ts +71 -36
  27. package/ts/Private/IAudioDeviceManager.ts +61 -31
  28. package/ts/Private/impl/IAgoraMediaEngineImpl.ts +12 -6
  29. package/ts/Private/impl/IAgoraRtcEngineImpl.ts +9 -11
  30. package/ts/Private/internal/IrisApiEngine.ts +14 -0
  31. package/ts/Private/internal/MusicContentCenterInternal.ts +4 -0
  32. package/ts/Private/internal/RtcEngineExInternal.ts +36 -14
  33. package/ts/Private/ti/IAgoraRtcEngine-ti.ts +2 -2
  34. package/ts/Renderer/WebGLRenderer/index.ts +26 -21
  35. package/ts/Renderer/YUVCanvasRenderer/index.ts +1 -1
  36. package/types/Private/AgoraBase.d.ts +298 -135
  37. package/types/Private/AgoraBase.d.ts.map +1 -1
  38. package/types/Private/AgoraMediaBase.d.ts +69 -35
  39. package/types/Private/AgoraMediaBase.d.ts.map +1 -1
  40. package/types/Private/AgoraMediaPlayerTypes.d.ts +8 -5
  41. package/types/Private/AgoraMediaPlayerTypes.d.ts.map +1 -1
  42. package/types/Private/IAgoraLog.d.ts +7 -3
  43. package/types/Private/IAgoraLog.d.ts.map +1 -1
  44. package/types/Private/IAgoraMediaEngine.d.ts +76 -35
  45. package/types/Private/IAgoraMediaEngine.d.ts.map +1 -1
  46. package/types/Private/IAgoraMediaPlayer.d.ts +126 -64
  47. package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -1
  48. package/types/Private/IAgoraMediaPlayerSource.d.ts +3 -1
  49. package/types/Private/IAgoraMediaPlayerSource.d.ts.map +1 -1
  50. package/types/Private/IAgoraRtcEngine.d.ts +1326 -530
  51. package/types/Private/IAgoraRtcEngine.d.ts.map +1 -1
  52. package/types/Private/IAgoraRtcEngineEx.d.ts +227 -94
  53. package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -1
  54. package/types/Private/IAgoraSpatialAudio.d.ts +71 -36
  55. package/types/Private/IAgoraSpatialAudio.d.ts.map +1 -1
  56. package/types/Private/IAudioDeviceManager.d.ts +61 -31
  57. package/types/Private/IAudioDeviceManager.d.ts.map +1 -1
  58. package/types/Private/impl/IAgoraMediaEngineImpl.d.ts +2 -2
  59. package/types/Private/impl/IAgoraMediaEngineImpl.d.ts.map +1 -1
  60. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +5 -5
  61. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -1
  62. package/types/Private/internal/IrisApiEngine.d.ts.map +1 -1
  63. package/types/Private/internal/MusicContentCenterInternal.d.ts +1 -0
  64. package/types/Private/internal/MusicContentCenterInternal.d.ts.map +1 -1
  65. package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -1
  66. package/types/Renderer/WebGLRenderer/index.d.ts +1 -1
  67. package/types/Renderer/WebGLRenderer/index.d.ts.map +1 -1
@@ -23,7 +23,8 @@ export abstract class IMediaPlayer {
23
23
  * Gets the ID of the media player.
24
24
  *
25
25
  * @returns
26
- * ≥ 0: Success. The ID of the media player. < 0: Failure.
26
+ * ≥ 0: Success. The ID of the media player.
27
+ * < 0: Failure.
27
28
  */
28
29
  abstract getMediaPlayerId(): number;
29
30
 
@@ -36,7 +37,8 @@ export abstract class IMediaPlayer {
36
37
  * @param startPos The starting position (ms) for playback. Default value is 0.
37
38
  *
38
39
  * @returns
39
- * 0: Success. < 0: Failure.
40
+ * 0: Success.
41
+ * < 0: Failure.
40
42
  */
41
43
  abstract open(url: string, startPos: number): number;
42
44
 
@@ -48,17 +50,19 @@ export abstract class IMediaPlayer {
48
50
  * @param source Media resources. See MediaSource.
49
51
  *
50
52
  * @returns
51
- * 0: Success. < 0: Failure.
53
+ * 0: Success.
54
+ * < 0: Failure.
52
55
  */
53
56
  abstract openWithMediaSource(source: MediaSource): number;
54
57
 
55
58
  /**
56
59
  * Plays the media file.
57
60
  *
58
- * After calling open or seek , you can call this method to play the media file.
61
+ * After calling open or seek, you can call this method to play the media file.
59
62
  *
60
63
  * @returns
61
- * 0: Success. < 0: Failure.
64
+ * 0: Success.
65
+ * < 0: Failure.
62
66
  */
63
67
  abstract play(): number;
64
68
 
@@ -66,7 +70,8 @@ export abstract class IMediaPlayer {
66
70
  * Pauses the playback.
67
71
  *
68
72
  * @returns
69
- * 0: Success. < 0: Failure.
73
+ * 0: Success.
74
+ * < 0: Failure.
70
75
  */
71
76
  abstract pause(): number;
72
77
 
@@ -74,7 +79,8 @@ export abstract class IMediaPlayer {
74
79
  * Stops playing the media track.
75
80
  *
76
81
  * @returns
77
- * 0: Success. < 0: Failure.
82
+ * 0: Success.
83
+ * < 0: Failure.
78
84
  */
79
85
  abstract stop(): number;
80
86
 
@@ -82,31 +88,36 @@ export abstract class IMediaPlayer {
82
88
  * Resumes playing the media file.
83
89
  *
84
90
  * @returns
85
- * 0: Success. < 0: Failure.
91
+ * 0: Success.
92
+ * < 0: Failure.
86
93
  */
87
94
  abstract resume(): number;
88
95
 
89
96
  /**
90
97
  * Seeks to a new playback position.
91
98
  *
92
- * fter successfully calling this method, you will receive the onPlayerEvent callback, reporting the result of the seek operation to the new playback position. To play the media file from a specific position, do the following: Call this method to seek to the position you want to begin playback. Call the play method to play the media file.
99
+ * After successfully calling this method, you will receive the onPlayerEvent callback, reporting the result of the seek operation to the new playback position. To play the media file from a specific position, do the following:
100
+ * Call this method to seek to the position you want to begin playback.
101
+ * Call the play method to play the media file.
93
102
  *
94
103
  * @param newPos The new playback position (ms).
95
104
  *
96
105
  * @returns
97
- * 0: Success. < 0: Failure.
106
+ * 0: Success.
107
+ * < 0: Failure.
98
108
  */
99
109
  abstract seek(newPos: number): number;
100
110
 
101
111
  /**
102
112
  * Sets the pitch of the current media resource.
103
113
  *
104
- * Call this method after calling open .
114
+ * Call this method after calling open.
105
115
  *
106
116
  * @param pitch Sets the pitch of the local music file by the chromatic scale. The default value is 0, which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file.
107
117
  *
108
118
  * @returns
109
- * 0: Success. < 0: Failure.
119
+ * 0: Success.
120
+ * < 0: Failure.
110
121
  */
111
122
  abstract setAudioPitch(pitch: number): number;
112
123
 
@@ -122,53 +133,61 @@ export abstract class IMediaPlayer {
122
133
  * Gets current local playback progress.
123
134
  *
124
135
  * @returns
125
- * Returns the current playback progress (ms) if the call succeeds. < 0: Failure. See MediaPlayerError .
136
+ * Returns the current playback progress (ms) if the call succeeds.
137
+ * < 0: Failure. See MediaPlayerError.
126
138
  */
127
139
  abstract getPlayPosition(): number;
128
140
 
129
141
  /**
130
142
  * Gets the number of the media streams in the media resource.
131
143
  *
132
- * Call this method after calling open .
144
+ * Call this method after calling open.
133
145
  *
134
146
  * @returns
135
- * The number of the media streams in the media resource if the method call succeeds. < 0: Failure. See MediaPlayerError .
147
+ * The number of the media streams in the media resource if the method call succeeds.
148
+ * < 0: Failure. See MediaPlayerError.
136
149
  */
137
150
  abstract getStreamCount(): number;
138
151
 
139
152
  /**
140
153
  * Gets the detailed information of the media stream.
141
154
  *
142
- * Call this method after calling getStreamCount .
155
+ * Call this method after calling getStreamCount.
143
156
  *
144
157
  * @param index The index of the media stream.
145
158
  *
146
159
  * @returns
147
- * If the call succeeds, returns the detailed information of the media stream. See PlayerStreamInfo . If the call fails, returns NULL .
160
+ * If the call succeeds, returns the detailed information of the media stream. See PlayerStreamInfo.
161
+ * If the call fails, returns NULL.
148
162
  */
149
163
  abstract getStreamInfo(index: number): PlayerStreamInfo;
150
164
 
151
165
  /**
152
166
  * Sets the loop playback.
153
167
  *
154
- * If you want to loop, call this method and set the number of the loops. When the loop finishes, the SDK triggers onPlayerSourceStateChanged and reports the playback state as PlayerStatePlaybackAllLoopsCompleted .
168
+ * If you want to loop, call this method and set the number of the loops. When the loop finishes, the SDK triggers onPlayerSourceStateChanged and reports the playback state as PlayerStatePlaybackAllLoopsCompleted.
155
169
  *
156
170
  * @param loopCount The number of times the audio effect loops:
157
171
  *
158
172
  * @returns
159
- * 0: Success. < 0: Failure.
173
+ * 0: Success.
174
+ * < 0: Failure.
160
175
  */
161
176
  abstract setLoopCount(loopCount: number): number;
162
177
 
163
178
  /**
164
179
  * Sets the channel mode of the current audio file.
165
180
  *
166
- * Call this method after calling open .
181
+ * Call this method after calling open.
167
182
  *
168
- * @param speed The playback speed. Agora recommends that you limit this value to between 50 and 400, defined as follows:50: Half the original speed.100: The original speed.400: 4 times the original speed.
183
+ * @param speed The playback speed. Agora recommends that you limit this value to a range between 50 and 400, which is defined as follows:
184
+ * 50: Half the original speed.
185
+ * 100: The original speed.
186
+ * 400: 4 times the original speed.
169
187
  *
170
188
  * @returns
171
- * 0: Success. < 0: Failure.
189
+ * 0: Success.
190
+ * < 0: Failure.
172
191
  */
173
192
  abstract setPlaybackSpeed(speed: number): number;
174
193
 
@@ -180,7 +199,8 @@ export abstract class IMediaPlayer {
180
199
  * @param index The index of the audio track.
181
200
  *
182
201
  * @returns
183
- * 0: Success. < 0: Failure.
202
+ * 0: Success.
203
+ * < 0: Failure.
184
204
  */
185
205
  abstract selectAudioTrack(index: number): number;
186
206
 
@@ -192,13 +212,16 @@ export abstract class IMediaPlayer {
192
212
  /**
193
213
  * Sets the private options for the media player.
194
214
  *
195
- * The media player supports setting private options by key and value. Under normal circumstances, you do not need to know the private option settings, and just use the default option settings. Ensure that you call this method before open . If you need to push streams with SEI into the CDN, call setPlayerOptionInString ("sei_data_with_uuid", 1) ; otherwise, the loss of SEI might occurs.
215
+ * The media player supports setting private options by key and value. Under normal circumstances, you do not need to know the private option settings, and just use the default option settings.
216
+ * Ensure that you call this method before open.
217
+ * If you need to push streams with SEI into the CDN, call setPlayerOptionInString ("sei_data_with_uuid", 1); otherwise, the loss of SEI might occurs.
196
218
  *
197
219
  * @param key The key of the option.
198
220
  * @param value The value of the key.
199
221
  *
200
222
  * @returns
201
- * 0: Success. < 0: Failure.
223
+ * 0: Success.
224
+ * < 0: Failure.
202
225
  */
203
226
  abstract setPlayerOptionInString(key: string, value: string): number;
204
227
 
@@ -221,17 +244,18 @@ export abstract class IMediaPlayer {
221
244
  * Gets current playback state.
222
245
  *
223
246
  * @returns
224
- * The current playback state. See MediaPlayerState .
247
+ * The current playback state. See MediaPlayerState.
225
248
  */
226
249
  abstract getState(): MediaPlayerState;
227
250
 
228
251
  /**
229
252
  * Sets whether to mute the media file.
230
253
  *
231
- * @param muted Whether to mute the media file:true: Mute the media file.false: (Default) Unmute the media file.
254
+ * @param muted Whether to mute the media file: true : Mute the media file. false : (Default) Unmute the media file.
232
255
  *
233
256
  * @returns
234
- * 0: Success. < 0: Failure.
257
+ * 0: Success.
258
+ * < 0: Failure.
235
259
  */
236
260
  abstract mute(muted: boolean): number;
237
261
 
@@ -246,10 +270,13 @@ export abstract class IMediaPlayer {
246
270
  /**
247
271
  * Adjusts the local playback volume.
248
272
  *
249
- * @param volume The local playback volume, which ranges from 0 to 100:0: Mute.100: (Default) The original volume.
273
+ * @param volume The local playback volume, which ranges from 0 to 100:
274
+ * 0: Mute.
275
+ * 100: (Default) The original volume.
250
276
  *
251
277
  * @returns
252
- * 0: Success. < 0: Failure.
278
+ * 0: Success.
279
+ * < 0: Failure.
253
280
  */
254
281
  abstract adjustPlayoutVolume(volume: number): number;
255
282
 
@@ -257,7 +284,9 @@ export abstract class IMediaPlayer {
257
284
  * Gets the local playback volume.
258
285
  *
259
286
  * @returns
260
- * The local playback volume, which ranges from 0 to 100. 0: Mute. 100: (Default) The original volume.
287
+ * The local playback volume, which ranges from 0 to 100.
288
+ * 0: Mute.
289
+ * 100: (Default) The original volume.
261
290
  */
262
291
  abstract getPlayoutVolume(): number;
263
292
 
@@ -266,10 +295,14 @@ export abstract class IMediaPlayer {
266
295
  *
267
296
  * After connected to the Agora server, you can call this method to adjust the volume of the media file heard by the remote user.
268
297
  *
269
- * @param volume The volume, which ranges from 0 to 400:0: Mute.100: (Default) The original volume.400: Four times the original volume (amplifying the audio signals by four times).
298
+ * @param volume The volume, which ranges from 0 to 400:
299
+ * 0: Mute.
300
+ * 100: (Default) The original volume.
301
+ * 400: Four times the original volume (amplifying the audio signals by four times).
270
302
  *
271
303
  * @returns
272
- * 0: Success. < 0: Failure.
304
+ * 0: Success.
305
+ * < 0: Failure.
273
306
  */
274
307
  abstract adjustPublishSignalVolume(volume: number): number;
275
308
 
@@ -277,7 +310,8 @@ export abstract class IMediaPlayer {
277
310
  * Gets the volume of the media file for publishing.
278
311
  *
279
312
  * @returns
280
- * ≥ 0: The remote playback volume. < 0: Failure.
313
+ * ≥ 0: The remote playback volume.
314
+ * < 0: Failure.
281
315
  */
282
316
  abstract getPublishSignalVolume(): number;
283
317
 
@@ -285,7 +319,8 @@ export abstract class IMediaPlayer {
285
319
  * Sets the view.
286
320
  *
287
321
  * @returns
288
- * 0: Success. < 0: Failure.
322
+ * 0: Success.
323
+ * < 0: Failure.
289
324
  */
290
325
  abstract setView(view: any): number;
291
326
 
@@ -295,7 +330,8 @@ export abstract class IMediaPlayer {
295
330
  * @param renderMode Sets the render mode of the view. See RenderModeType.
296
331
  *
297
332
  * @returns
298
- * 0: Success. < 0: Failure.
333
+ * 0: Success.
334
+ * < 0: Failure.
299
335
  */
300
336
  abstract setRenderMode(renderMode: RenderModeType): number;
301
337
 
@@ -305,7 +341,8 @@ export abstract class IMediaPlayer {
305
341
  * @param observer The player observer, listening for events during the playback. See IMediaPlayerSourceObserver.
306
342
  *
307
343
  * @returns
308
- * 0: Success. < 0: Failure.
344
+ * 0: Success.
345
+ * < 0: Failure.
309
346
  */
310
347
  abstract registerPlayerSourceObserver(
311
348
  observer: IMediaPlayerSourceObserver
@@ -317,7 +354,8 @@ export abstract class IMediaPlayer {
317
354
  * @param observer The player observer, listening for events during the playback. See IMediaPlayerSourceObserver.
318
355
  *
319
356
  * @returns
320
- * 0: Success. < 0: Failure.
357
+ * 0: Success.
358
+ * < 0: Failure.
321
359
  */
322
360
  abstract unregisterPlayerSourceObserver(
323
361
  observer: IMediaPlayerSourceObserver
@@ -330,7 +368,8 @@ export abstract class IMediaPlayer {
330
368
  * @param mode The use mode of the audio frame. See RawAudioFrameOpModeType.
331
369
  *
332
370
  * @returns
333
- * 0: Success. < 0: Failure.
371
+ * 0: Success.
372
+ * < 0: Failure.
334
373
  */
335
374
  abstract registerAudioFrameObserver(
336
375
  observer: IAudioPcmFrameSink,
@@ -343,7 +382,8 @@ export abstract class IMediaPlayer {
343
382
  * @param observer The audio observer. See IAudioPcmFrameSink.
344
383
  *
345
384
  * @returns
346
- * 0: Success. < 0: Failure.
385
+ * 0: Success.
386
+ * < 0: Failure.
347
387
  */
348
388
  abstract unregisterAudioFrameObserver(observer: IAudioPcmFrameSink): number;
349
389
 
@@ -355,7 +395,8 @@ export abstract class IMediaPlayer {
355
395
  * @param observer The video observer, reporting the reception of each video frame. See IMediaPlayerVideoFrameObserver.
356
396
  *
357
397
  * @returns
358
- * 0: Success. < 0: Failure.
398
+ * 0: Success.
399
+ * < 0: Failure.
359
400
  */
360
401
  abstract registerVideoFrameObserver(
361
402
  observer: IMediaPlayerVideoFrameObserver
@@ -367,7 +408,8 @@ export abstract class IMediaPlayer {
367
408
  * @param observer The video observer, reporting the reception of each video frame. See IMediaPlayerVideoFrameObserver.
368
409
  *
369
410
  * @returns
370
- * 0: Success. < 0: Failure.
411
+ * 0: Success.
412
+ * < 0: Failure.
371
413
  */
372
414
  abstract unregisterVideoFrameObserver(
373
415
  observer: IMediaPlayerVideoFrameObserver
@@ -391,12 +433,15 @@ export abstract class IMediaPlayer {
391
433
  /**
392
434
  * Sets the channel mode of the current audio file.
393
435
  *
394
- * In a stereo music file, the left and right channels can store different audio data. According to your needs, you can set the channel mode to original mode, left channel mode, right channel mode, or mixed channel mode. For example, in the KTV scenario, the left channel of the music file stores the musical accompaniment, and the right channel stores the singing voice. If you only need to listen to the accompaniment, call this method to set the channel mode of the music file to left channel mode; if you need to listen to the accompaniment and the singing voice at the same time, call this method to set the channel mode to mixed channel mode. Call this method after calling open . This method only applies to stereo audio files.
436
+ * In a stereo music file, the left and right channels can store different audio data. According to your needs, you can set the channel mode to original mode, left channel mode, right channel mode, or mixed channel mode. For example, in the KTV scenario, the left channel of the music file stores the musical accompaniment, and the right channel stores the singing voice. If you only need to listen to the accompaniment, call this method to set the channel mode of the music file to left channel mode; if you need to listen to the accompaniment and the singing voice at the same time, call this method to set the channel mode to mixed channel mode.
437
+ * Call this method after calling open.
438
+ * This method only applies to stereo audio files.
395
439
  *
396
440
  * @param mode The channel mode. See AudioDualMonoMode.
397
441
  *
398
442
  * @returns
399
- * 0: Success. < 0: Failure.
443
+ * 0: Success.
444
+ * < 0: Failure.
400
445
  */
401
446
  abstract setAudioDualMonoMode(mode: AudioDualMonoMode): number;
402
447
 
@@ -451,26 +496,35 @@ export abstract class IMediaPlayer {
451
496
  /**
452
497
  * Switches the media resource being played.
453
498
  *
454
- * You can call this method to switch the media resource to be played according to the current network status. For example: When the network is poor, the media resource to be played is switched to a media resource address with a lower bitrate. When the network is good, the media resource to be played is switched to a media resource address with a higher bitrate. After calling this method, if you receive the PlayerEventSwitchComplete event in the onPlayerEvent callback, the switch is successful; If you receive the PlayerEventSwitchError event in the onPlayerEvent callback, the switch fails. Ensure that you call this method after open . To ensure normal playback, pay attention to the following when calling this method: Do not call this method when playback is paused. Do not call the seek method during switching. Before switching the media resource, make sure that the playback position does not exceed the total duration of the media resource to be switched.
499
+ * You can call this method to switch the media resource to be played according to the current network status. For example:
500
+ * When the network is poor, the media resource to be played is switched to a media resource address with a lower bitrate.
501
+ * When the network is good, the media resource to be played is switched to a media resource address with a higher bitrate. After calling this method, if you receive the PlayerEventSwitchComplete event in the onPlayerEvent callback, the switch is successful; If you receive the PlayerEventSwitchError event in the onPlayerEvent callback, the switch fails.
502
+ * Ensure that you call this method after open.
503
+ * To ensure normal playback, pay attention to the following when calling this method:
504
+ * Do not call this method when playback is paused.
505
+ * Do not call the seek method during switching.
506
+ * Before switching the media resource, make sure that the playback position does not exceed the total duration of the media resource to be switched.
455
507
  *
456
508
  * @param src The URL of the media resource.
457
- * @param syncPts Whether to synchronize the playback position (ms) before and after the switch:true: Synchronize the playback position before and after the switch.false: (Default) Do not synchronize the playback position before and after the switch.Make sure to set this parameter as false if you need to play live streams, or the switch fails. If you need to play on-demand streams, you can set the value of this parameter according to your scenarios.
509
+ * @param syncPts Whether to synchronize the playback position (ms) before and after the switch: true : Synchronize the playback position before and after the switch. false : (Default) Do not synchronize the playback position before and after the switch. Make sure to set this parameter as false if you need to play live streams, or the switch fails. If you need to play on-demand streams, you can set the value of this parameter according to your scenarios.
458
510
  *
459
511
  * @returns
460
- * 0: Success. < 0: Failure.
512
+ * 0: Success.
513
+ * < 0: Failure.
461
514
  */
462
515
  abstract switchSrc(src: string, syncPts?: boolean): number;
463
516
 
464
517
  /**
465
518
  * Preloads a media resource.
466
519
  *
467
- * You can call this method to preload a media resource into the playlist. If you need to preload multiple media resources, you can call this method multiple times. After calling this method, if you receive the PlayerPreloadEventComplete event in the onPreloadEvent callback, the preload is successful; If you receive the PlayerPreloadEventError event in the onPreloadEvent callback, the preload fails. If the preload is successful and you want to play the media resource, call playPreloadedSrc ; if you want to clear the playlist, call stop . Agora does not support preloading duplicate media resources to the playlist. However, you can preload the media resources that are being played to the playlist again.
520
+ * You can call this method to preload a media resource into the playlist. If you need to preload multiple media resources, you can call this method multiple times. After calling this method, if you receive the PlayerPreloadEventComplete event in the onPreloadEvent callback, the preload is successful; If you receive the PlayerPreloadEventError event in the onPreloadEvent callback, the preload fails. If the preload is successful and you want to play the media resource, call playPreloadedSrc; if you want to clear the playlist, call stop. Agora does not support preloading duplicate media resources to the playlist. However, you can preload the media resources that are being played to the playlist again.
468
521
  *
469
522
  * @param src The URL of the media resource.
470
523
  * @param startPos The starting position (ms) for playing after the media resource is preloaded to the playlist. When preloading a live stream, set this parameter to 0.
471
524
  *
472
525
  * @returns
473
- * 0: Success. < 0: Failure.
526
+ * 0: Success.
527
+ * < 0: Failure.
474
528
  */
475
529
  abstract preloadSrc(src: string, startPos: number): number;
476
530
 
@@ -482,7 +536,8 @@ export abstract class IMediaPlayer {
482
536
  * @param src The URL of the media resource in the playlist must be consistent with the src set by the preloadSrc method; otherwise, the media resource cannot be played.
483
537
  *
484
538
  * @returns
485
- * 0: Success. < 0: Failure.
539
+ * 0: Success.
540
+ * < 0: Failure.
486
541
  */
487
542
  abstract playPreloadedSrc(src: string): number;
488
543
 
@@ -494,7 +549,8 @@ export abstract class IMediaPlayer {
494
549
  * @param src The URL of the media resource.
495
550
  *
496
551
  * @returns
497
- * 0: Success. < 0: Failure.
552
+ * 0: Success.
553
+ * < 0: Failure.
498
554
  */
499
555
  abstract unloadSrc(src: string): number;
500
556
 
@@ -504,7 +560,8 @@ export abstract class IMediaPlayer {
504
560
  * After successfully setting the spatial audio effect parameters of the media player, the SDK enables the spatial audio effect for the media player, and the local user can hear the media resources with a sense of space. If you need to disable the spatial audio effect for the media player, set the params parameter to null.
505
561
  *
506
562
  * @returns
507
- * 0: Success. < 0: Failure.
563
+ * 0: Success.
564
+ * < 0: Failure.
508
565
  */
509
566
  abstract setSpatialAudioParams(params: SpatialAudioParams): number;
510
567
 
@@ -524,7 +581,8 @@ export abstract class IMediaPlayerCacheManager {
524
581
  * The cached media file currently being played will not be deleted.
525
582
  *
526
583
  * @returns
527
- * 0: Success. < 0: Failure. See MediaPlayerError .
584
+ * 0: Success.
585
+ * < 0: Failure. See MediaPlayerError.
528
586
  */
529
587
  abstract removeAllCaches(): number;
530
588
 
@@ -535,7 +593,7 @@ export abstract class IMediaPlayerCacheManager {
535
593
  *
536
594
  * @returns
537
595
  * 0: Success.
538
- * < 0: Failure. See MediaPlayerError .
596
+ * < 0: Failure. See MediaPlayerError.
539
597
  */
540
598
  abstract removeOldCache(): number;
541
599
 
@@ -548,7 +606,7 @@ export abstract class IMediaPlayerCacheManager {
548
606
  *
549
607
  * @returns
550
608
  * 0: Success.
551
- * < 0: Failure. See MediaPlayerError .
609
+ * < 0: Failure. See MediaPlayerError.
552
610
  */
553
611
  abstract removeCacheByUri(uri: string): number;
554
612
 
@@ -561,7 +619,7 @@ export abstract class IMediaPlayerCacheManager {
561
619
  *
562
620
  * @returns
563
621
  * 0: Success.
564
- * < 0: Failure. See MediaPlayerError .
622
+ * < 0: Failure. See MediaPlayerError.
565
623
  */
566
624
  abstract setCacheDir(path: string): number;
567
625
 
@@ -572,7 +630,7 @@ export abstract class IMediaPlayerCacheManager {
572
630
  *
573
631
  * @returns
574
632
  * 0: Success.
575
- * < 0: Failure. See MediaPlayerError .
633
+ * < 0: Failure. See MediaPlayerError.
576
634
  */
577
635
  abstract setMaxCacheFileCount(count: number): number;
578
636
 
@@ -583,7 +641,7 @@ export abstract class IMediaPlayerCacheManager {
583
641
  *
584
642
  * @returns
585
643
  * 0: Success.
586
- * < 0: Failure. See MediaPlayerError .
644
+ * < 0: Failure. See MediaPlayerError.
587
645
  */
588
646
  abstract setMaxCacheFileSize(cacheSize: number): number;
589
647
 
@@ -592,11 +650,11 @@ export abstract class IMediaPlayerCacheManager {
592
650
  *
593
651
  * If you enable this function to remove cached media files automatically, when the cached media files exceed either the number or size limit you set, the SDK automatically deletes the least recently used cache file.
594
652
  *
595
- * @param enable Whether to enable the SDK to delete cached media files automatically:true: Delete cached media files automatically.false: (Default) Do not delete cached media files automatically.
653
+ * @param enable Whether to enable the SDK to delete cached media files automatically: true : Delete cached media files automatically. false : (Default) Do not delete cached media files automatically.
596
654
  *
597
655
  * @returns
598
656
  * 0: Success.
599
- * < 0: Failure. See MediaPlayerError .
657
+ * < 0: Failure. See MediaPlayerError.
600
658
  */
601
659
  abstract enableAutoRemoveCache(enable: boolean): number;
602
660
 
@@ -608,7 +666,8 @@ export abstract class IMediaPlayerCacheManager {
608
666
  * @param length An input parameter; the maximum length of the cache file storage path string.
609
667
  *
610
668
  * @returns
611
- * The call succeeds, and the SDK returns the storage path of the cached media files. < 0: Failure. See MediaPlayerError .
669
+ * The call succeeds, and the SDK returns the storage path of the cached media files.
670
+ * < 0: Failure. See MediaPlayerError.
612
671
  */
613
672
  abstract getCacheDir(length: number): string;
614
673
 
@@ -618,7 +677,8 @@ export abstract class IMediaPlayerCacheManager {
618
677
  * By default, the maximum number of media files that can be cached is 1,000.
619
678
  *
620
679
  * @returns
621
- * > 0: The call succeeds and returns the maximum number of media files that can be cached. < 0: Failure. See MediaPlayerError .
680
+ * > 0: The call succeeds and returns the maximum number of media files that can be cached.
681
+ * < 0: Failure. See MediaPlayerError.
622
682
  */
623
683
  abstract getMaxCacheFileCount(): number;
624
684
 
@@ -628,7 +688,8 @@ export abstract class IMediaPlayerCacheManager {
628
688
  * By default, the maximum size of the aggregate storage space for cached media files is 1 GB. You can call the setMaxCacheFileSize method to set the limit according to your scenarios.
629
689
  *
630
690
  * @returns
631
- * > 0: The call succeeds and returns the maximum size (in bytes) of the aggregate storage space for cached media files. < 0: Failure. See MediaPlayerError .
691
+ * > 0: The call succeeds and returns the maximum size (in bytes) of the aggregate storage space for cached media files.
692
+ * < 0: Failure. See MediaPlayerError.
632
693
  */
633
694
  abstract getMaxCacheFileSize(): number;
634
695
 
@@ -636,7 +697,8 @@ export abstract class IMediaPlayerCacheManager {
636
697
  * Gets the number of media files that are cached.
637
698
  *
638
699
  * @returns
639
- * ≥ 0: The call succeeds and returns the number of media files that are cached. < 0: Failure. See MediaPlayerError .
700
+ * ≥ 0: The call succeeds and returns the number of media files that are cached.
701
+ * < 0: Failure. See MediaPlayerError.
640
702
  */
641
703
  abstract getCacheFileCount(): number;
642
704
  }
@@ -62,7 +62,9 @@ export interface IMediaPlayerSourceObserver {
62
62
  /**
63
63
  * Reports the playback duration that the buffered data can support.
64
64
  *
65
- * When playing online media resources, the SDK triggers this callback every two seconds to report the playback duration that the currently buffered data can support. When the playback duration supported by the buffered data is less than the threshold (0 by default), the SDK returns PlayerEventBufferLow . When the playback duration supported by the buffered data is greater than the threshold (0 by default), the SDK returns PlayerEventBufferRecover .
65
+ * When playing online media resources, the SDK triggers this callback every two seconds to report the playback duration that the currently buffered data can support.
66
+ * When the playback duration supported by the buffered data is less than the threshold (0 by default), the SDK returns PlayerEventBufferLow.
67
+ * When the playback duration supported by the buffered data is greater than the threshold (0 by default), the SDK returns PlayerEventBufferRecover.
66
68
  *
67
69
  * @param playCachedBuffer The playback duration (ms) that the buffered data can support.
68
70
  */