Agora Java API Reference for Android
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
io.agora.musiccontentcenter.IAgoraMusicContentCenter Class Referenceabstract

Classes

class  MusicCacheStatusType
 
class  MusicContentCenterStateReason
 
class  PreloadState
 

Public Member Functions

abstract int initialize (MusicContentCenterConfiguration configuration)
 
abstract int renewToken (String token)
 
abstract IAgoraMusicPlayer createMusicPlayer ()
 
abstract int destroyMusicPlayer (IAgoraMusicPlayer player)
 
abstract int registerEventHandler (IMusicContentCenterEventHandler eventHandler)
 
abstract int unregisterEventHandler ()
 
abstract String preload (long songCode)
 
abstract int preload (long songCode, String jsonOption)
 
abstract int isPreloaded (long songCode)
 
abstract String getMusicCharts ()
 
String getMusicCollectionByMusicChartId (int musicChartId, int page, int pageSize)
 
abstract String getMusicCollectionByMusicChartId (int musicChartId, int page, int pageSize, String jsonOption)
 
String searchMusic (String keyword, int page, int pageSize)
 
abstract String searchMusic (String keyword, int page, int pageSize, String jsonOption)
 
abstract String getLyric (long songCode, int lyricType)
 
abstract int removeCache (long songCode)
 
abstract MusicCacheInfo[] getCaches ()
 
abstract String getSongSimpleInfo (long songCode)
 
abstract long getInternalSongCode (long songCode, String jsonOption)
 

Static Public Member Functions

static synchronized IAgoraMusicContentCenter create (RtcEngine rtcEngine)
 
static synchronized void destroy ()
 

Protected Member Functions

abstract void doDestroy ()
 

Member Function Documentation

◆ initialize()

abstract int io.agora.musiccontentcenter.IAgoraMusicContentCenter.initialize ( MusicContentCenterConfiguration  configuration)
abstract

set coryright music token and other param

Parameters
configuration
Returns
  • 0: Success.
  • < 0: Failure.

◆ renewToken()

abstract int io.agora.musiccontentcenter.IAgoraMusicContentCenter.renewToken ( String  token)
abstract

Renew token of music content center

Parameters
tokenThe new token.
Returns
  • 0: Success.
  • < 0: Failure.

◆ createMusicPlayer()

abstract IAgoraMusicPlayer io.agora.musiccontentcenter.IAgoraMusicContentCenter.createMusicPlayer ( )
abstract

Creates a music player source object and return its pointer.

Returns
- The pointer to IMusicPlayer, if the method call succeeds.
  • The empty pointer NULL, if the method call fails.

◆ destroyMusicPlayer()

abstract int io.agora.musiccontentcenter.IAgoraMusicContentCenter.destroyMusicPlayer ( IAgoraMusicPlayer  player)
abstract

Destroy a music player source object and return result.

Parameters
playerThe music player.
Returns
  • 0: Success.
  • < 0: Failure.

◆ preload() [1/2]

abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.preload ( long  songCode)
abstract

Preload a media file with specified parameters.

Parameters
songCodeThe identify of the media file that you want to play.
Returns
The request identification

◆ preload() [2/2]

abstract int io.agora.musiccontentcenter.IAgoraMusicContentCenter.preload ( long  songCode,
String  jsonOption 
)
abstract

Preload a media file with specified parameters.

Parameters
songCodeThe identify of the media file that you want to play.
jsonOptionThe ext param, default is null.
Returns
  • 0: Success, file is preloaded.
  • < 0: Failure.
Deprecated:
use preload(long songCode) instead.

◆ isPreloaded()

abstract int io.agora.musiccontentcenter.IAgoraMusicContentCenter.isPreloaded ( long  songCode)
abstract

Check if the media file is preloaded

Parameters
songCodeThe identify of the media file that you want to play.
Returns
  • 0: Success, file is preloaded.
  • < 0: Failure.

◆ getMusicCharts()

abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.getMusicCharts ( )
abstract

Get music chart list of music.

Returns
The request identification

◆ getMusicCollectionByMusicChartId() [1/2]

String io.agora.musiccontentcenter.IAgoraMusicContentCenter.getMusicCollectionByMusicChartId ( int  musicChartId,
int  page,
int  pageSize 
)

Get song list of the music chart by musicChartId and page info.

Parameters
musicChartIdThe musicChartId id from getMusicCharts.
pageThe page, start from 1.
pageSizeThe page size, max is 50.
Returns
The request identification

◆ getMusicCollectionByMusicChartId() [2/2]

abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.getMusicCollectionByMusicChartId ( int  musicChartId,
int  page,
int  pageSize,
String  jsonOption 
)
abstract

Get song list of the music chart by musicChartId and page info.

Parameters
musicChartIdThe musicChartId id from getMusicCharts.
pageThe page, start from 1.
pageSizeThe page size, max is 50.
jsonOptionThe ext param, default is null.
Returns
The request identification

◆ searchMusic() [1/2]

String io.agora.musiccontentcenter.IAgoraMusicContentCenter.searchMusic ( String  keyword,
int  page,
int  pageSize 
)

Get hot song list by musicChartId and page info.

Parameters
keywordThe key word to search.
pageThe page, start from 1.
pageSizeThe page size, max is 50.
Returns
The request identification

◆ searchMusic() [2/2]

abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.searchMusic ( String  keyword,
int  page,
int  pageSize,
String  jsonOption 
)
abstract

Get hot song list by musicChartId and page info.

Parameters
keywordThe key word to search.
pageThe page, start from 1.
pageSizeThe page size, max is 50.
jsonOptionThe ext param, default is null.
Returns
The request identification

◆ getLyric()

abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.getLyric ( long  songCode,
int  lyricType 
)
abstract

Get lyric of the song.

Parameters
songCodeThe identifier of the media file that you want to play.
lyricTypeThe type of the lyric file. may be 0:xml or 1:lrc.
Returns
The request identification

◆ removeCache()

abstract int io.agora.musiccontentcenter.IAgoraMusicContentCenter.removeCache ( long  songCode)
abstract

Remove a cached media file.

Parameters
songCodeThe identifier of the media file that you want to play.
Returns
  • 0: Success; the cached media file is removed.
  • < 0: Failure.

◆ getCaches()

abstract MusicCacheInfo [] io.agora.musiccontentcenter.IAgoraMusicContentCenter.getCaches ( )
abstract

Get cached media files.

Returns
The array of MusicCacheInfo.

◆ getSongSimpleInfo()

abstract String io.agora.musiccontentcenter.IAgoraMusicContentCenter.getSongSimpleInfo ( long  songCode)
abstract

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.

Parameters
songCodeThe identifier of the media file.
Returns
The request identification

◆ getInternalSongCode()

abstract long io.agora.musiccontentcenter.IAgoraMusicContentCenter.getInternalSongCode ( long  songCode,
String  jsonOption 
)
abstract

Create internal songCodeKey from songCode and jsonOption

Parameters
songCodeThe identifier of the media file.
jsonOptionAn 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.
Returns
- Internal songCode key, if the method call succeeds.
  • The number less than zero, if the method call fails.