Agora RTC Objective-C API Reference Refactor

Instance Methods
<AgoraMusicContentCenterEventDelegate> Protocol Reference

Inherits <NSObjectNSObject>.

## Instance Methods
(void) | - onMusicChartsResult:result:reason:
(void) | - onMusicCollectionResult:result:reason:
(void) | - onLyricResult:songCode:lyricUrl:reason:
(void) | - onSongSimpleInfoResult:songCode:simpleInfo:reason:
(void) | - onPreLoadEvent:songCode:percent:lyricUrl:state:reason:

## Detailed Description

The request event delegate callback

## Method Documentation

## ◆ onMusicChartsResult:result:reason:

- (void) onMusicChartsResult: |  | (NSString *) | requestId
result: |  | (NSArray< AgoraMusicChartInfo * > *) | result
reason: |  | (AgoraMusicContentCenterStateReason) | reason

Callback for retrieving music charts.

After you call the `getMusicCharts` method to retrieve all available music charts, the SDK triggers this callback.

Parameters

  requestId | The request ID. A unique identifier for this request.
  reason | The request status code from the music content center. See `AgoraMusicContentCenterStateReason`.
  result | The list of currently playable music charts. See `AgoraMusicChartInfo`.

## ◆ onMusicCollectionResult:result:reason:

- (void) onMusicCollectionResult: |  | (NSString *) | requestId
result: |  | (AgoraMusicCollection *) | result
reason: |  | (AgoraMusicContentCenterStateReason) | reason

Callback for retrieving the music content list.

When you call the `getMusicCollectionWithMusicChartId:page:pageSize:jsonOption:` method to get the music content list of a specified chart, or call `searchMusicWithKeyWord:page:pageSize:jsonOption:` to search for music content, the SDK triggers this callback to report the detailed information of the music content list in the chart.

Parameters

  requestId | The request ID. A unique identifier for this request.
  reason | The request status code from the music content center. See `AgoraMusicContentCenterStateReason`.
  result | The detailed information of the music content list. See `AgoraMusicCollection`.

## ◆ onLyricResult:songCode:lyricUrl:reason:

- (void) onLyricResult: |  | (NSString *) | requestId
songCode: |  | (NSInteger) | songCode
lyricUrl: |  | (NSString *_Nullable) | lyricUrl
reason: |  | (AgoraMusicContentCenterStateReason) | reason

Callback for the lyric download URL.

After you call `getLyricWithSongCode:lyricType:` to get the lyric download URL of a specified song, the SDK triggers this callback.

Parameters

  requestId | The request ID. A unique identifier for this request.
  songCode | The identifier of the music resource, used to specify the music resource.
  lyricUrl | The download URL of the lyrics.
  reason | The request status code from the music content center. See `AgoraMusicContentCenterStateReason` for details.

## ◆ onSongSimpleInfoResult:songCode:simpleInfo:reason:

- (void) onSongSimpleInfoResult: |  | (NSString *) | requestId
songCode: |  | (NSInteger) | songCode
simpleInfo: |  | (NSString *_Nullable) | simpleInfo
reason: |  | (AgoraMusicContentCenterStateReason) | reason

Callback for detailed information of a music resource.

This callback is triggered by the SDK after you call `getSongSimpleInfoWithSongCode:` to retrieve the detailed information of a specific music resource.

Parameters

  requestId | The request ID. A unique identifier for this request.
  songCode | The identifier of the music resource.
  simpleInfo | The related information of the music resource, including: Start and end time (ms) of the chorus segment Lyric download URL of the chorus segment Duration (ms) of the chorus segment Song name Singer name
  reason | The request status code from the music content center. See `AgoraMusicContentCenterStateReason` for details.

## ◆ onPreLoadEvent:songCode:percent:lyricUrl:state:reason:

- (void) onPreLoadEvent: |  | (NSString *) | requestId
songCode: |  | (NSInteger) | songCode
percent: |  | (NSInteger) | percent
lyricUrl: |  | (NSString *_Nullable) | lyricUrl
state: |  | (AgoraMusicContentCenterPreloadState) | state
reason: |  | (AgoraMusicContentCenterStateReason) | reason

Reports the event of preloading a music resource.

After you call the `preloadWithSongCode:jsonOption:` or `preloadWithSongCode:` method to preload a music resource, the SDK triggers this callback.

Parameters

  requestId | The request ID. A unique identifier for this request.
  songCode | The code of the music resource, used to identify a specific music resource.
  percent | The current loading progress of the music resource, ranging from [0,100].
  lyricUrl | The URL to download the lyrics.
  state | The current loading status of the music resource. See `AgoraMusicContentCenterPreloadState`.
  reason | The request status code from the music content center. See `AgoraMusicContentCenterStateReason`.