Skip to content

Commit 1c90bf2

Browse files
[AUTO] Generate code by terra
1 parent 9ccd3a2 commit 1c90bf2

15 files changed

+861
-683
lines changed

ts/AgoraSdk.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export * from './Utils';
2626
const instance = new RtcEngineExInternal();
2727

2828
/**
29-
* Creates an IRtcEngine object.
30-
* Currently, the Agora RTC SDK v4.x supports creating only one IRtcEngine object for each app.
29+
* IRtcEngineEx
30+
* Currently, the Agora RTC SDK v4.x supports creating only one IRtcEngineEx object for each app.
3131
*
3232
* @returns
33-
* One IRtcEngine object.
33+
* One IRtcEngineEx object.
3434
*/
3535
export function createAgoraRtcEngine(options?: AgoraEnvOptions): IRtcEngineEx {
3636
Object.assign(AgoraEnv, options);

ts/Private/AgoraBase.ts

+147-147
Large diffs are not rendered by default.

ts/Private/AgoraMediaBase.ts

+54-57
Large diffs are not rendered by default.

ts/Private/AgoraMediaPlayerTypes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ export class MediaSource {
404404
*/
405405
autoPlay?: boolean;
406406
/**
407-
* Whether to cache the media file when it is being played:true:Enables caching.false: (Default) Disables caching.The SDK only supports caching on-demand streams.If you need to enable caching, pass in a value to uri; otherwise, caching is based on the url of the media file.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 .
407+
* Whether to cache the media file when it is being played:true:Enables caching.false: (Default) Disables caching.Agora only supports caching on-demand audio and video streams that are not transmitted in HLS protocol.If you need to enable caching, pass in a value to uri; otherwise, caching is based on the url of the media file.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 .
408408
*/
409409
enableCache?: boolean;
410410
/**

ts/Private/IAgoraLog.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ export enum LogFilterType {
6868
*/
6969
export class LogConfig {
7070
/**
71-
* The complete path of the log files. Ensure that the path for the log file exists and is writable. You can use this parameter to rename the log files.The default file path is:macOSIf Sandbox is enabled: App~/Library/Logs/agorasdk.log. For example, /Users/<username>/Library/Containers/<AppBundleIdentifier>/Data/Library/Logs/agorasdk.log.If Sandbox is disabled: ~/Library/Logs/agorasdk.log.Windows:C:\Users\<user_name>\AppData\Local\Agora\<process_name>\agorasdk.log
71+
* The complete path of the log files. Ensure that the path for the log file exists and is writable. You can use this parameter to rename the log files.The default path is:macOS:If Sandbox is enabled: App Sandbox/Library/Logs/agorasdk.log. For example, /Users/<username>/Library/Containers/<AppBundleIdentifier>/Data/Library/Logs/agorasdk.log.If Sandbox is disabled: ~/Library/Logs/agorasdk.logWindows: C:\Users\<user_name>\AppData\Local\Agora\<process_name>\agorasdk.log.
7272
*/
7373
filePath?: string;
7474
/**
75-
* The size (KB) of an agorasdk.log file. The value range is [128,1024]. The default value is 1,024 KB. If you set fileSizeInKByte to a value lower than 128 KB, the SDK adjusts it to 128 KB. If you set fileSizeInKBytes to a value higher than 1,024 KB, the SDK adjusts it to 1,024 KB.
75+
* The size (KB) of an agorasdk.log file. The value range is [128,1024]. The default value is 1,024 KB. If you set fileSizeInKByte smaller than 128 KB, the SDK automatically adjusts it to 128 KB; if you set fileSizeInKByte greater than 1,024 KB, the SDK automatically adjusts it to 1,024 KB.
7676
*/
7777
fileSizeInKB?: number;
7878
/**

ts/Private/IAgoraMediaEngine.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,8 @@ export abstract class IMediaEngine {
8484
/**
8585
* Pushes the external audio frame.
8686
*
87-
* @param type The type of the audio recording device. See MediaSourceType .
8887
* @param frame The external audio frame. See AudioFrame .
89-
* @param wrap Whether to use the placeholder. Agora recommends using the default value.true: Use the placeholder.false: (Default) Do not use the placeholder.
90-
* @param sourceId The ID of external audio source. If you want to publish a custom external audio source, set this parameter to the ID of the corresponding custom audio track you want to publish.
88+
* @param trackId The audio track ID. If you want to publish a custom external audio source, set this parameter to the ID of the corresponding custom audio track you want to publish.
9189
*
9290
* @returns
9391
* 0: Success.< 0: Failure.
@@ -127,7 +125,7 @@ export abstract class IMediaEngine {
127125
* Call this method before joining a channel.
128126
*
129127
* @param enabled Whether to enable the external audio source:true: Enable the external audio source.false: (Default) Disable the external audio source.
130-
* @param sampleRate The sample rate (Hz) of the external audio which can be set as 8000, 16000, 32000, 44100, or 48000.
128+
* @param sampleRate The sample rate (Hz) of the external audio source which can be set as 8000, 16000, 32000, 44100, or 48000.
131129
* @param channels The number of channels of the external audio source, which can be set as 1 (Mono) or 2 (Stereo).
132130
* @param sourceNumber The number of external audio sources. The value of this parameter should be larger than 0. The SDK creates a corresponding number of custom audio tracks based on this parameter value and names the audio tracks starting from 0. In ChannelMediaOptions , you can set publishCustomAudioSourceId to the audio track ID you want to publish.
133131
* @param localPlayback Whether to play the external audio source:true: Play the external audio source.false: (Default) Do not play the external source.
@@ -145,15 +143,27 @@ export abstract class IMediaEngine {
145143
): number;
146144

147145
/**
148-
* @ignore
146+
* Creates a customized audio track.
147+
* When you need to publish multiple custom captured videos in the channel, you can refer to the following steps:Call this method to create a video track and get the video track ID.In ChannelMediaOptions of each channel, set customVideoTrackId to the video track ID that you want to publish, and set publishCustomVideoTrack to true.If you call pushAudioFrame trackId as the video track ID set in step 2, you can publish the corresponding custom video source in multiple channels.
148+
*
149+
* @param trackType The type of the custom audio track. See AudioTrackType .
150+
* @param config The configuration of the custom audio track. See AudioTrackConfig .
151+
*
152+
* @returns
153+
* If the method call is successful, the video track ID is returned as the unique identifier of the video track.If the method call fails, a negative value is returned.
149154
*/
150155
abstract createCustomAudioTrack(
151156
trackType: AudioTrackType,
152157
config: AudioTrackConfig
153158
): number;
154159

155160
/**
156-
* @ignore
161+
* Destroys the specified video track.
162+
*
163+
* @param trackId The custom audio track ID returned in createCustomAudioTrack .
164+
*
165+
* @returns
166+
* 0: Success.< 0: Failure.
157167
*/
158168
abstract destroyCustomAudioTrack(trackId: number): number;
159169

ts/Private/IAgoraMediaPlayer.ts

+38-15
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export abstract class IMediaPlayer {
3131
* Opens the media resource.
3232
* This method is called asynchronously.If you need to play a media file, make sure you receive the onPlayerSourceStateChanged callback reporting PlayerStateOpenCompleted before calling the play method to play the file.
3333
*
34-
* @param url The path of the media file. Both local path and online path are supported.On the Android platform, if you need to open a file in URI format, use open .
34+
* @param url The path of the media file. Both local path and online path are supported.
3535
* @param startPos The starting position (ms) for playback. Default value is 0.
3636
*
3737
* @returns
@@ -164,7 +164,13 @@ export abstract class IMediaPlayer {
164164
abstract setPlaybackSpeed(speed: number): number;
165165

166166
/**
167-
* @ignore
167+
* Selects the audio track used during playback.
168+
* After getting the track index of the audio file, you can call this method to specify any track to play. For example, if different tracks of a multi-track file store songs in different languages, you can call this method to set the playback language.You need to call this method after calling getStreamInfo to get the audio stream index value.
169+
*
170+
* @param index The index of the audio track.
171+
*
172+
* @returns
173+
* 0: Success.< 0: Failure.
168174
*/
169175
abstract selectAudioTrack(index: number): number;
170176

@@ -198,7 +204,13 @@ export abstract class IMediaPlayer {
198204
abstract takeScreenshot(filename: string): number;
199205

200206
/**
201-
* @ignore
207+
* Gets the detailed information of the media stream.
208+
* Call this method after calling getStreamCount .
209+
*
210+
* @param index The index of the media stream.
211+
*
212+
* @returns
213+
* If the call succeeds, returns the detailed information of the media stream. See PlayerStreamInfo .If the call fails, returns NULL.
202214
*/
203215
abstract selectInternalSubtitle(index: number): number;
204216

@@ -272,7 +284,7 @@ export abstract class IMediaPlayer {
272284
* Gets the volume of the media file for publishing.
273285
*
274286
* @returns
275-
* The remote playback volume, if the method call succeeds.< 0: Failure.
287+
* ≥ 0: The remote playback volume.< 0: Failure.
276288
*/
277289
abstract getPublishSignalVolume(): number;
278290

@@ -284,7 +296,12 @@ export abstract class IMediaPlayer {
284296
abstract setView(view: any): number;
285297

286298
/**
287-
* @ignore
299+
* Sets the render mode of the media player.
300+
*
301+
* @param renderMode Sets the render mode of the view. See RenderModeType .
302+
*
303+
* @returns
304+
* 0: Success.< 0: Failure.
288305
*/
289306
abstract setRenderMode(renderMode: RenderModeType): number;
290307

@@ -315,17 +332,21 @@ export abstract class IMediaPlayer {
315332
/**
316333
* Registers an audio frame observer object.
317334
*
335+
* @param observer The audio frame observer, reporting the reception of each audio frame. See IAudioPcmFrameSink .
318336
* @param mode The use mode of the audio frame. See RawAudioFrameOpModeType .
337+
*
338+
* @returns
339+
* 0: Success.< 0: Failure.
319340
*/
320341
abstract registerAudioFrameObserver(
321342
observer: IAudioPcmFrameSink,
322343
mode?: RawAudioFrameOpModeType
323344
): number;
324345

325346
/**
326-
* Unregisters an audio observer.
347+
* Unregisters an audio frame observer.
327348
*
328-
* @param observer The audio observer. See IMediaPlayerAudioFrameObserver .
349+
* @param observer The audio observer. See IAudioPcmFrameSink .
329350
*
330351
* @returns
331352
* 0: Success.< 0: Failure.
@@ -366,9 +387,9 @@ export abstract class IMediaPlayer {
366387
): number;
367388

368389
/**
369-
* Unregisters the encoded audio frame observer.
390+
* Unregisters the video frame observer.
370391
*
371-
* @param observer The encoded audio observer. See IAudioEncodedFrameObserver .
392+
* @param observer The video observer, reporting the reception of each video frame. See IVideoFrameObserver .
372393
*
373394
* @returns
374395
* 0: Success.< 0: Failure.
@@ -394,7 +415,10 @@ export abstract class IMediaPlayer {
394415
abstract getPlayerSdkVersion(): string;
395416

396417
/**
397-
* @ignore
418+
* Gets the path of the media resource being played.
419+
*
420+
* @returns
421+
* The path of the media resource being played.
398422
*/
399423
abstract getPlaySrc(): string;
400424

@@ -512,8 +536,7 @@ export abstract class IMediaPlayerCacheManager {
512536
* You can call this method to delete a cached media file when the storage space for the cached files is about to reach its limit. After you call this method, the SDK deletes the cached media file that is least used.The cached media file currently being played will not be deleted.
513537
*
514538
* @returns
515-
* 0: Success.
516-
* < 0: Failure. See MediaPlayerError .
539+
* 0: Success.< 0: Failure. See MediaPlayerError .
517540
*/
518541
abstract removeOldCache(): number;
519542

@@ -524,8 +547,7 @@ export abstract class IMediaPlayerCacheManager {
524547
* @param uri The URI (Uniform Resource Identifier) of the media file to be deleted.
525548
*
526549
* @returns
527-
* 0: Success.
528-
* < 0: Failure. See MediaPlayerError .
550+
* 0: Success.< 0: Failure. See MediaPlayerError .
529551
*/
530552
abstract removeCacheByUri(uri: string): number;
531553

@@ -557,7 +579,8 @@ export abstract class IMediaPlayerCacheManager {
557579
* @param cacheSize The maximum size (bytes) of the aggregate storage space for cached media files. The default value is 1 GB.
558580
*
559581
* @returns
560-
* 0: Success.< 0: Failure. See MediaPlayerError .
582+
* 0: Success.
583+
* < 0: Failure. See MediaPlayerError .
561584
*/
562585
abstract setMaxCacheFileSize(cacheSize: number): number;
563586

ts/Private/IAgoraMediaPlayerSource.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import {
1313
*/
1414
export interface IMediaPlayerSourceObserver {
1515
/**
16-
* Reports the playback state change.
16+
* Reports the changes of playback state.
1717
* When the state of the media player changes, the SDK triggers this callback to report the current playback state.
1818
*
19-
* @param state The playback state, see MediaPlayerState .
19+
* @param state The playback state. See MediaPlayerState .
2020
* @param ec The error code. See MediaPlayerError .
2121
*/
2222
onPlayerSourceStateChanged?(
@@ -26,17 +26,17 @@ export interface IMediaPlayerSourceObserver {
2626

2727
/**
2828
* Reports current playback progress.
29-
* When playing media files, the SDK triggers this callback every one second to report current playback progress.
29+
* When playing media files, the SDK triggers this callback every two second to report current playback progress.
3030
*
3131
* @param position The playback position (ms) of media files.
3232
*/
3333
onPositionChanged?(positionMs: number): void;
3434

3535
/**
36-
* Reports the playback event.
36+
* Reports the player events.
3737
* After calling the seek method, the SDK triggers the callback to report the results of the seek operation.
3838
*
39-
* @param eventCode The playback event. See MediaPlayerEvent .
39+
* @param eventCode The player events. See MediaPlayerEvent .
4040
* @param elapsedTime The time (ms) when the event occurs.
4141
* @param message Information about the event.
4242
*/

ts/Private/IAgoraMediaRecorder.ts

+16-9
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,37 @@ import {
55
} from './AgoraMediaBase';
66

77
/**
8-
* Used for recording audio and video on the client.
9-
* IMediaRecorder can record the following:
10-
* The audio captured by the local microphone and encoded in AAC format.The video captured by the local camera and encoded by the SDK.
8+
* This class provides APIs for local and remote recording.
119
*/
1210
export abstract class IMediaRecorder {
1311
/**
14-
* Registers one IMediaRecorderObserver object.
15-
* Make sure that IRtcEngine is initialized before you call this method.
12+
* Registers one IMediaRecorderObserver oberver.
13+
* This method is used to set the callbacks of audio and video recording, so as to notify the app of the recording status and information of the audio and video stream during recording.Before calling this method, ensure the following:The IRtcEngine object is created and initialized.The recording object is created through createMediaRecorder .
1614
*
17-
* @param connection The connection information. See RtcConnection .
18-
* @param callback The callbacks for recording local audio and video streams. See IMediaRecorderObserver .
15+
* @param callback The callbacks for recording audio and video streams. See IMediaRecorderObserver .
1916
*
2017
* @returns
2118
* 0: Success.< 0: Failure.
2219
*/
2320
abstract setMediaRecorderObserver(callback: IMediaRecorderObserver): number;
2421

2522
/**
26-
* @ignore
23+
* Starts recording audio and video streams.
24+
* You can call this method to enable the recording function. Agora supports recording the media streams of local and remote users at the same time.Before you call this method, ensure the following:The recording object is created through createMediaRecorder .The recording observer is registered through setMediaRecorderObserver .You have joined the channel which the remote user that you want to record is in.Supported formats of recording are listed as below:AAC-encoded audio captured by the microphone.Video captured by a camera and encoded in H.264 or H.265.Once the recording is started, if the video resolution is changed, the SDK stops the recording; if the sampling rate and audio channel changes, the SDK continues recording and generates audio files respectively.The SDK can generate a recording file only when it detects audio and video streams; when there are no audio and video streams to be recorded or the audio and video streams are interrupted for more than five seconds, the SDK stops the recording and triggers the onRecorderStateChanged(RecorderStateError, RecorderErrorNoStream) callback.If you want to record the media streams of the local user, ensure the role of the local user is set as broadcaster.If you want to record the media streams of a remote user, ensure you have subscribed to the user's media streams before starting the recording.
25+
*
26+
* @param config The recording configuration. See MediaRecorderConfiguration .
27+
*
28+
* @returns
29+
* 0: Success.< 0: Failure.-2: The parameter is invalid. Ensure the following:The specified path of the recording file exists and is writable.The specified format of the recording file is supported.The maximum recording duration is correctly set.-4: IRtcEngine does not support the request. The recording is ongoing or the recording stops because an error occurs.-7: The method is called before IRtcEngine is initialized. Ensure the IMediaRecorder object is created before calling this method.
2730
*/
2831
abstract startRecording(config: MediaRecorderConfiguration): number;
2932

3033
/**
31-
* @ignore
34+
* Stops recording audio and video streams.
35+
* After calling startRecording , if you want to stop the recording, you must call this method; otherwise, the generated recording files may not be playable.
36+
*
37+
* @returns
38+
* 0: Success.< 0: Failure.-7: The method is called before IRtcEngine is initialized. Ensure the IMediaRecorder object is created before calling this method.
3239
*/
3340
abstract stopRecording(): number;
3441
}

ts/Private/IAgoraMusicContentCenter.ts

+16-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ export abstract class MusicChartCollection {
109109
abstract getCount(): number;
110110

111111
/**
112-
* @ignore
112+
* Gets the detailed information of the media stream.
113+
* Call this method after calling getStreamCount .
114+
*
115+
* @param index The index of the media stream.
116+
*
117+
* @returns
118+
* If the call succeeds, returns the detailed information of the media stream. See PlayerStreamInfo .If the call fails, returns NULL.
113119
*/
114120
abstract get(index: number): MusicChartInfo;
115121
}
@@ -377,12 +383,19 @@ export abstract class IMusicContentCenter {
377383
abstract preload(songCode: number, jsonOption?: string): number;
378384

379385
/**
380-
* @ignore
386+
* 删除已缓存的音乐资源。
387+
* 你可以调用该方法删除某一已缓存的音乐资源,如需删除多个音乐资源,你可以多次调用该方法。 The cached media file currently being played will not be deleted.
388+
*
389+
* @param songCode 待删除的音乐资源的编号。
390+
*
391+
* @returns
392+
* 0: 方法调用成功,音乐资源已删除。< 0: Failure.
381393
*/
382394
abstract removeCache(songCode: number): number;
383395

384396
/**
385-
* @ignore
397+
* 获取已缓存的音乐资源信息。
398+
* 当你不再需要使用已缓存的音乐资源时,你需要及时释放内存以防止内存泄漏。
386399
*/
387400
abstract getCaches(): { cacheInfo: MusicCacheInfo[]; cacheInfoSize: number };
388401

0 commit comments

Comments
 (0)