Agora Java API Reference for Android

Classes | Public Member Functions | List of all members
io.agora.musiccontentcenter.IAgoraMusicPlayer Interface Reference
Inheritance diagram for io.agora.musiccontentcenter.IAgoraMusicPlayer:

## Classes
enum | MusicPlayMode

## Public Member Functions
int | open (long songCode, long startPos)
int | open (String url, long startPos)
int | destroy ()
String | getPlaySrc ()
int | stop ()
int | setPlayMode (MusicPlayMode mode)
Public Member Functions inherited from io.agora.mediaplayer.IMediaPlayer
int | getMediaPlayerId ()
int | open (Uri uri, long startPos)
int | openWithMediaSource (MediaPlayerSource source)
int | play ()
int | pause ()
int | resume ()
int | seek (long newPos)
int | setAudioPitch (int pitch)
int | mute (boolean muted)
| Turn mute on or off. More...
boolean | getMute ()
| Get mute state. More...
int | adjustPlayoutVolume (int volume)
| Adjust playback volume. More...
int | getPlayoutVolume ()
| Get the current playback volume. More...
long | getPlayPosition ()
long | getDuration ()
| Get media duration. More...
int | getAudioBufferDelay ()
| Get audio buffer delay when playing. More...
Constants.MediaPlayerState | getState ()
| Get player state. More...
int | getStreamCount ()
| Get the number of streams in the media. More...
int | setView (View videoView)
| Set video rendering view. More...
int | setRenderMode (int mode)
| Set video display mode. More...
MediaStreamInfo | getStreamInfo (int index)
int | setLoopCount (int loopCount)
int | setPlaybackSpeed (int speed)
int | selectAudioTrack (int index)
int | selectMultiAudioTrack (int playoutTrackIndex, int publishTrackIndex)
int | setPlayerOption (String key, int value)
int | setPlayerOptionString (String key, String value)
int | takeScreenshot (String filename)
int | selectInternalSubtitle (int index)
int | setExternalSubtitle (String url)
int | adjustPublishSignalVolume (int volume)
| adjust publish signal volume More...
int | getPublishSignalVolume ()
| get publish signal volume More...
int | switchSrc (String src, boolean syncPts)
| switch to another play source More...
int | preloadSrc (String src, long startPos)
| preload another play source More...
int | playPreloadedSrc (String src)
| play the preloaded source More...
int | unloadSrc (String src)
int | registerPlayerObserver (IMediaPlayerObserver playerObserver)
int | unRegisterPlayerObserver (IMediaPlayerObserver playerObserver)
int | registerAudioFrameObserver (IMediaPlayerAudioFrameObserver audioFrameObserver, int mode)
int | registerMediaPlayerAudioSpectrumObserver (IAudioSpectrumObserver observer, int intervalInMS)
int | unregisterMediaPlayerAudioSpectrumObserver (IAudioSpectrumObserver observer)
int | setAudioDualMonoMode (int mode)
int | registerVideoFrameObserver (IMediaPlayerVideoFrameObserver videoFrameObserver)
int | openWithAgoraCDNSrc (String src, long startPos)
int | getAgoraCDNLineCount ()
int | switchAgoraCDNLineByIndex (int index)
int | getCurrentAgoraCDNIndex ()
int | enableAutoSwitchAgoraCDN (boolean enable)
int | renewAgoraCDNSrcToken (String token, long ts)
int | switchAgoraCDNSrc (String src, boolean syncPts)
int | setSpatialAudioParams (SpatialAudioParams params)

## Member Function Documentation

## ◆ open() [1/2]

int io.agora.musiccontentcenter.IAgoraMusicPlayer.open | ( | long | songCode,
|  | long | startPos
| ) |  |

open a media file with specified parameters.

Parameters

  songCode | The identify of the media file that you want to play.
  startPos | The playback position (ms) of the music file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ open() [2/2]

int io.agora.musiccontentcenter.IAgoraMusicPlayer.open | ( | String | url,
|  | long | startPos
| ) |  |

Opens a media file with an android URI.

Parameters

  url | The URL of the media file that you want to play.

Returns
  - 0: Success.
  - < 0: Failure.

Implements io.agora.mediaplayer.IMediaPlayer.

## ◆ destroy()

int io.agora.musiccontentcenter.IAgoraMusicPlayer.destroy | ( |  | ) |

Deprecated:
  use IAgoraMusicContentCenter#destroyMusicPlayer(IAgoraMusicPlayer player) instead.

Implements io.agora.mediaplayer.IMediaPlayer.

## ◆ getPlaySrc()

String io.agora.musiccontentcenter.IAgoraMusicPlayer.getPlaySrc | ( |  | ) |

Gets the url of the media file being played or the songCode of the media file you opened.

Returns
  The url of the media file being played or the songCode of the media file you opened.

Implements io.agora.mediaplayer.IMediaPlayer.

## ◆ stop()

int io.agora.musiccontentcenter.IAgoraMusicPlayer.stop | ( |  | ) |

Stops playing the current media file.

- 0: Success.
- < 0: Failure.

Implements io.agora.mediaplayer.IMediaPlayer.

## ◆ setPlayMode()

int io.agora.musiccontentcenter.IAgoraMusicPlayer.setPlayMode | ( | MusicPlayMode | mode | ) |

Set the mode for playing songs. You can call this method to switch from original to accompaniment or lead vocals. If you do not call this method to set the mode, the SDK plays the accompaniment by default.

Parameters

  mode | The playing mode.

Returns
  - 0: Success.
  - < 0: Failure.