|
Agora RTC Objective-C API Reference
Refactor
|
Inherits <NSObject>.
Instance Methods | |
| (NSInteger) | - renewToken: |
| (NSInteger) | - registerEventDelegate: |
| (id< AgoraMusicPlayerProtocol > _Nullable) | - createMusicPlayerWithDelegate: |
| (NSInteger) | - destroyMusicPlayer: |
| (NSString *) | - getMusicCharts |
| (NSString *) | - getMusicCollectionWithMusicChartId:page:pageSize:jsonOption: |
| (NSString *) | - searchMusicWithKeyWord:page:pageSize:jsonOption: |
| (NSInteger) | - preloadWithSongCode:jsonOption: |
| (NSString *) | - preloadWithSongCode: |
| (NSInteger) | - isPreloadedWithSongCode: |
| (NSInteger) | - removeCacheWithSongCode: |
| (NSArray *) | - getCaches |
| (NSInteger) | - getInternalSongCode:jsonOption: |
| (NSString *) | - getLyricWithSongCode:lyricType: |
| (NSString *) | - getSongSimpleInfoWithSongCode: |
Class Methods | |
| (instancetype _Nullable) | + sharedContentCenterWithConfig: |
| (void) | + destroy |
| + (instancetype _Nullable) sharedContentCenterWithConfig: | (AgoraMusicContentCenterConfig *) | config |
Create an AgoraMusicContentCenter instance.
| config | Configurations for the AgoraMusicContentCenter instance. For details, see AgoraMusicContentCenterConfig. |
| - (NSInteger) renewToken: | (NSString *_Nonnull) | token |
Renew token of music content center
| token | The new token. |
| - (NSInteger) registerEventDelegate: | (id< AgoraMusicContentCenterEventDelegate > _Nullable) | eventDelegate |
Register an event delegate, only the last delegate is working.
| eventDelegate | the object who need AgoraRtcMediaPlayerDelegate method to get the player information , if you want remove the delegate, just pass nil |
| - (id<AgoraMusicPlayerProtocol> _Nullable) createMusicPlayerWithDelegate: | (id< AgoraRtcMediaPlayerDelegate > _Nullable) | delegate |
Creates a music player source object and return its pointer.
| delegate | The object who need AgoraRtcMediaPlayerDelegate method to get the player information |
| - (NSInteger) destroyMusicPlayer: | (id< AgoraMusicPlayerProtocol >) | musicPlayer |
Destroy a music player source object and return result.
| musicPlayer | The music player. |
| - (NSString *) getMusicCharts |
Get music chart collection of music.If the method call success, get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicChartsResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(NSArray<AgoraMusicChartInfo*> *)result; match the callback "requestId" parameter to get the request result.
| - (NSString *) getMusicCollectionWithMusicChartId: | (NSInteger) | musicChartId | |
| page: | (NSInteger) | page | |
| pageSize: | (NSInteger) | pageSize | |
| jsonOption: | (NSString *_Nullable) | jsonOption | |
Get hot music list by hotType and page info.If the method call success, get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicCollectionResult:(NSString *)requestId status:(AgoraMusicContentCenterStateReason)status result:(AgoraMusicCollection *)result; match the callback "requestId" parameter to get the request result.
| musicChartId | The music chart id obtained from getMusicCharts. |
| page | The page of the music chart, starting from 1 |
| pageSize | The page size, max is 50. |
| jsonOption | The ext param, default is null. |
| - (NSString *) searchMusicWithKeyWord: | (NSString *) | keyWord | |
| page: | (NSInteger) | page | |
| pageSize: | (NSInteger) | pageSize | |
| jsonOption: | (NSString *_Nullable) | jsonOption | |
Search music by keyword and page info. get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicCollectionResult:(NSString *)requestId status:(AgoraMusicContentCenterStateReason)status result:(AgoraMusicCollection *)result; match the callback "requestId" parameter to get the request result.
| keyWord | The key word to search. |
| page | The page of the music search result, starting from 1 |
| pageSize | The page size, max is 50. |
| jsonOption | The ext param, default is null. |
| - (NSInteger) preloadWithSongCode: | (NSInteger) | songCode | |
| jsonOption: | (NSString *_Nullable) | jsonOption | |
Preload a media file with specified parameters.
| songCode | The identify of the media file that you want to play. |
| jsonOption | The ext param, default is null. |
| - (NSString *) preloadWithSongCode: | (NSInteger) | songCode |
Preload a media file with specified parameters.
| songCode | The identify of the media file that you want to play. |
| - (NSInteger) isPreloadedWithSongCode: | (NSInteger) | songCode |
Preload a media file with specified parameters.
| songCode | The identify of the media file that you want to play. |
| - (NSInteger) removeCacheWithSongCode: | (NSInteger) | songCode |
Remove a media file cache
| songCode | The identifier of the media file that you want to play. |
| - (NSArray *) getCaches |
Get media cache files.
| - (NSInteger) getInternalSongCode: | (NSInteger) | songCode | |
| jsonOption: | (NSString *_Nullable) | jsonOption | |
Get internal songCodeKey from songCode and jsonOption
| songCode | The identifier of the media file. |
| jsonOption | An extention parameter. The default value is null. it’s a json-format string and the key and value can be customized according to your scenarios. |
| - (NSString *) getLyricWithSongCode: | (NSInteger) | songCode | |
| lyricType: | (NSInteger) | lyricType | |
Get lyric of the song. get result from the AgoraMusicContentCenterEventDelegate - (void)onLyricResult:(NSString*)requestId lyricUrl:(NSString*)lyricUrl; match the callback "requestId" parameter to get the request result.
| songCode | The identify of the media file that you want to play. |
| lyricType | The type of the lyric file. may be 0:xml or 1:lrc. |
| - (NSString *) getSongSimpleInfoWithSongCode: | (NSInteger) | songCode |
Gets the metadata of a specific music. Once this method is called, the SDK triggers the onSongSimpleInfoResult callback to report the metadata of the music.
| songCode | The identify of the media file that you want to play. |
| + (void) destroy |
Destroy the shared instance of AgoraMusicContentCenter
| - (void) onMusicChartsResult: | (NSString *) | requestId | |
| result: | (NSArray< AgoraMusicChartInfo * > *) | result | |
| errorCode: | (AgoraMusicContentCenterStateReason) | errorCode | |
| - (void) onMusicCollectionResult: | (NSString *) | requestId | |
| result: | (AgoraMusicCollection *) | result | |
| errorCode: | (AgoraMusicContentCenterStateReason) | errorCode | |
| - (void) onLyricResult: | (NSString *) | requestId | |
| songCode: | (NSInteger) | songCode | |
| lyricUrl: | (NSString *_Nullable) | lyricUrl | |
| errorCode: | (AgoraMusicContentCenterStateReason) | errorCode | |
| - (void) onSongSimpleInfoResult: | (NSString *) | requestId | |
| songCode: | (NSInteger) | songCode | |
| simpleInfo: | (NSString *_Nullable) | simpleInfo | |
| errorCode: | (AgoraMusicContentCenterStateReason) | errorCode | |
| - (void) onPreLoadEvent: | (NSString *) | requestId | |
| songCode: | (NSInteger) | songCode | |
| percent: | (NSInteger) | percent | |
| lyricUrl: | (NSString *_Nullable) | lyricUrl | |
| state: | (AgoraMusicContentCenterPreloadState) | state | |
| errorCode: | (AgoraMusicContentCenterStateReason) | errorCode | |