Agora RTC Objective-C API Reference
Refactor
|
Inherits <NSObject>.
Instance Methods | |
(NSInteger) | - renewToken: |
(NSInteger) | - registerEventDelegate: |
(id< AgoraMusicPlayerProtocol >) | - createMusicPlayerWithDelegate: |
(NSString *) | - getMusicCharts |
(NSString *) | - getMusicCollectionWithMusicChartId:page:pageSize:jsonOption: |
(NSString *) | - searchMusicWithKeyWord:page:pageSize:jsonOption: |
(NSInteger) | - preloadWithSongCode:jsonOption: |
(NSInteger) | - isPreloadedWithSongCode: |
(NSString *) | - getLyricWithSongCode:lyricType: |
Class Methods | |
(instancetype) | + sharedContentCenterWithConfig: |
(void) | + destroy |
+ (instancetype) 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>) 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 |
- (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:(AgoraMusicContentCenterStatusCode)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:(AgoraMusicContentCenterStatusCode)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. |
option | The ext param, default is null. |
- (NSInteger) isPreloadedWithSongCode: | (NSInteger) | songCode |
Preload a media file with specified parameters.
songCode | The identify of the media file that you want to play. |
- (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. |
+ (void) destroy |
Destroy the shared instance of AgoraMusicContentCenter