|
| abstract int | initialize (MusicContentCenterConfiguration configuration) |
| | Initializes IAgoraMusicContentCenter. More...
|
| |
| abstract int | renewToken (String token) |
| | Renews the Token. More...
|
| |
| abstract IAgoraMusicPlayer | createMusicPlayer () |
| | Creates a music player. More...
|
| |
| abstract int | destroyMusicPlayer (IAgoraMusicPlayer player) |
| | Destroys the music player object. More...
|
| |
| abstract int | registerEventHandler (IMusicContentCenterEventHandler eventHandler) |
| | Registers the callback events for the music content center. More...
|
| |
| abstract int | unregisterEventHandler () |
| | Unregisters the event callback for the music content center. More...
|
| |
| abstract String | preload (long songCode) |
| | Preloads copyright music resources. More...
|
| |
| abstract int | preload (long songCode, String jsonOption) |
| | Preloads music resources. More...
|
| |
| abstract int | isPreloaded (long songCode) |
| | Checks whether a music resource has been preloaded. More...
|
| |
| abstract String | getMusicCharts () |
| | Retrieves all music charts. More...
|
| |
| String | getMusicCollectionByMusicChartId (int musicChartId, int page, int pageSize) |
| | Retrieves the list of music resources from a specified music chart by its ID. More...
|
| |
| abstract String | getMusicCollectionByMusicChartId (int musicChartId, int page, int pageSize, String jsonOption) |
| | Retrieves the list of music resources from a specified music chart by its ID. More...
|
| |
| String | searchMusic (String keyword, int page, int pageSize) |
| | Searches for music resources. More...
|
| |
| abstract String | searchMusic (String keyword, int page, int pageSize, String jsonOption) |
| | Searches for music resources. More...
|
| |
| abstract String | getLyric (long songCode, int lyricType) |
| | Retrieves the download URL for the lyrics of a music resource. More...
|
| |
| abstract int | removeCache (long songCode) |
| | Deletes a cached music resource. More...
|
| |
| abstract MusicCacheInfo[] | getCaches () |
| | Retrieves information about cached music resources. More...
|
| |
| abstract String | getSongSimpleInfo (long songCode) |
| | Retrieves detailed information about a specific music resource. More...
|
| |
| abstract long | getInternalSongCode (long songCode, String jsonOption) |
| | Creates an internal identifier for the chorus clip of a music resource. More...
|
| |
| abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.preload |
( |
long |
songCode | ) |
|
|
abstract |
Preloads copyright music resources.
You can call this method to preload the copyright music resources you want to play. After the method is successfully called, the SDK triggers the onPreLoadEvent callback to report the event of preloading the copyright music resource. Before calling this method to preload copyright music resources, you need to call getMusicCollectionByMusicChartId(int musicChartId, int page, int pageSize) or searchMusic(String keyword, int page, int pageSize) to obtain the copyright music resources you want to play, and retrieve the music resource identifier (songCode) through the onMusicCollectionResult callback triggered by these methods.
- Note
- To destroy the
RtcEngine object, make sure to call the destroy() method only after receiving the onPreLoadEvent callback.
- Parameters
-
| songCode | The identifier of the copyright music resource. |
- Returns
- A
requestId, which is the unique identifier for this request.
| abstract int io.agora.musiccontentcenter.IAgoraMusicContentCenter.preload |
( |
long |
songCode, |
|
|
String |
jsonOption |
|
) |
| |
|
abstract |
Preloads music resources.
- Deprecated:
- use preload(long songCode) instead.
You can call this method to preload the music resources you want to play. After this method is successfully called, the SDK triggers the onPreLoadEvent callback to report the preload event. Before calling this method to preload music resources, you need to call getMusicCollectionByMusicChartId(int musicChartId, int page, int pageSize) or searchMusic(String keyword, int page, int pageSize) to retrieve the music resources you want to play, and obtain the resource identifier (songCode) from the onMusicCollectionResult callback triggered by those methods.
- Note
- To destroy the
RtcEngine object, make sure to call the destroy() method after receiving the onPreLoadEvent callback.
- Parameters
-
| songCode | The identifier of the music resource. |
| jsonOption | Extended JSON field. Agora charges based on the application scenario you set in the sceneType field. Different scenarios are billed at different rates. Refer to the billing documentation for details.
- 1: Live streaming scenario: Karaoke and background music playback.
- 2: Live streaming scenario: Background music playback.
- 3: (Default) Voice chat scenario: Karaoke.
- 4: Voice chat scenario: Background music playback.
- 5: VR scenario: Karaoke and background music playback. If you need to switch to a different scenario, you must call this method again and pass the new
sceneType value in this field. Example: {"sceneType":1}
|
- Returns
- 0: The method call succeeds.
- < 0: The method call fails. See
Error Codes for details and troubleshooting.
| abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.getSongSimpleInfo |
( |
long |
songCode | ) |
|
|
abstract |
Retrieves detailed information about a specific music resource.
Before calling this method, you need to obtain the identifier of the corresponding music resource. You can do this by calling the getMusicCollectionByMusicChartId(int musicChartId, int page, int pageSize) or searchMusic(String keyword, int page, int pageSize) method to retrieve music resources, and obtain the music resource identifier (songCode) through the triggered onMusicCollectionResult callback. After you call this method, the SDK triggers the onSongSimpleInfoResult callback to report the detailed information of the music resource.
- Parameters
-
| songCode | The identifier of the music resource, used to specify the music resource. |
- Returns
- A
requestId that uniquely identifies this request.
| abstract long io.agora.musiccontentcenter.IAgoraMusicContentCenter.getInternalSongCode |
( |
long |
songCode, |
|
|
String |
jsonOption |
|
) |
| |
|
abstract |
Creates an internal identifier for the chorus clip of a music resource.
Applicable scenarios: Before you play the chorus clip of a music resource, you need to call this method to create an internal identifier for the chorus clip using the jsonOption parameter and the songCode of the music resource. This identifier serves as the unique reference for the resource. Once you get this identifier, you need to pass it as the songCode parameter when calling related methods to open, preload, or remove the resource.
- Parameters
-
| songCode | The identifier of the music resource. You can obtain this by calling getMusicCollectionByMusicChartId(int musicChartId, int page, int pageSize) or searchMusic(String keyword, int page, int pageSize), and retrieve the songCode from the onMusicCollectionResult callback triggered by these methods. |
| jsonOption | Extended JSON field, defaults to NULL. Currently supports the following values:
| Key | Value | Example |
| sceneType | Channel profile: - 1: Live streaming scenario: karaoke and background music playback. - 2: Live streaming scenario: background music playback. - 3: (Default) Voice chat scenario: karaoke. - 4: Voice chat scenario: background music playback. - 5: VR scenario: karaoke and background music playback. Note: Agora charges based on the sceneType you provide. Different channel profiles have different pricing rates. Refer to the billing documentation for details. To switch to a different channel profile, you must call this method again with a new sceneType value. | {"sceneType":1} |
| highPart | Index of the chorus clip. You can obtain the index from the onMusicCollectionResult callback. The index starts from 0. | {"format": {"highpart": 0}} |
|
- Returns
- If the method call succeeds, returns the created internal identifier of the music resource.
- < 0: The method call fails. Refer to
Error Codes for details and troubleshooting advice.