|
Agora Java API Reference for Android
|
Public Member Functions | |
| int | getMediaPlayerId () |
| int | open (Uri uri, long startPos) |
| int | open (String url, long startPos) |
| int | openWithMediaSource (MediaPlayerSource source) |
| int | play () |
| int | pause () |
| int | stop () |
| 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... | |
| 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... | |
| String | getPlaySrc () |
| 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 | destroy () |
| 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) |
| int io.agora.mediaplayer.IMediaPlayer.getMediaPlayerId | ( | ) |
Get unique source id of the media player.
| int io.agora.mediaplayer.IMediaPlayer.open | ( | Uri | uri, |
| long | startPos | ||
| ) |
Opens a media file with a specified URL.
| uri | The uri of the media file that you want to play. |
| int io.agora.mediaplayer.IMediaPlayer.open | ( | String | url, |
| long | startPos | ||
| ) |
Opens a media file with a andorid URI.
| url | The URL of the media file that you want to play. |
Implemented in io.agora.musiccontentcenter.IAgoraMusicPlayer.
| int io.agora.mediaplayer.IMediaPlayer.openWithMediaSource | ( | MediaPlayerSource | source | ) |
Opens a media file with a media file source.
| source | Media file source that you want to play, see MediaSource |
| int io.agora.mediaplayer.IMediaPlayer.play | ( | ) |
Plays the media file.
| int io.agora.mediaplayer.IMediaPlayer.pause | ( | ) |
Pauses playing the media file.
| int io.agora.mediaplayer.IMediaPlayer.stop | ( | ) |
Stops playing the current media file.
Implemented in io.agora.musiccontentcenter.IAgoraMusicPlayer.
| int io.agora.mediaplayer.IMediaPlayer.resume | ( | ) |
Resumes playing the media file.
| int io.agora.mediaplayer.IMediaPlayer.seek | ( | long | newPos | ) |
Sets the current playback position of the media file.
| newPos | The new playback position (ms). |
| int io.agora.mediaplayer.IMediaPlayer.setAudioPitch | ( | int | pitch | ) |
Sets the pitch of the current media file.
| pitch | Sets the pitch of the local music file by chromatic scale. The default value is 0, which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file. |
| int io.agora.mediaplayer.IMediaPlayer.mute | ( | boolean | muted | ) |
Turn mute on or off.
| muted | Whether to mute on |
| boolean io.agora.mediaplayer.IMediaPlayer.getMute | ( | ) |
Get mute state.
| int io.agora.mediaplayer.IMediaPlayer.adjustPlayoutVolume | ( | int | volume | ) |
Adjust playback volume.
| volume | The volume value to be adjusted The volume can be adjusted from 0 to 400: 0: mute; 100: original volume; 400: Up to 4 times the original volume (with built-in overflow protection). |
| int io.agora.mediaplayer.IMediaPlayer.getPlayoutVolume | ( | ) |
Get the current playback volume.
| [out] | volume |
| long io.agora.mediaplayer.IMediaPlayer.getPlayPosition | ( | ) |
Gets the current playback position of the media file.
| long io.agora.mediaplayer.IMediaPlayer.getDuration | ( | ) |
Get media duration.
| [out] | duration | Duration in seconds |
| Constants.MediaPlayerState io.agora.mediaplayer.IMediaPlayer.getState | ( | ) |
Get player state.
| int io.agora.mediaplayer.IMediaPlayer.getStreamCount | ( | ) |
Get the number of streams in the media.
| [out] | count |
| int io.agora.mediaplayer.IMediaPlayer.setView | ( | View | videoView | ) |
Set video rendering view.
| videoView | view object, windows platform is HWND |
| int io.agora.mediaplayer.IMediaPlayer.setRenderMode | ( | int | mode | ) |
Set video display mode.
| mode | Video display mode |
| int io.agora.mediaplayer.IMediaPlayer.setLoopCount | ( | int | loopCount | ) |
Sets whether to loop the media file for playback.
| loopCount | the number of times looping the media file.
|
| int io.agora.mediaplayer.IMediaPlayer.setPlaybackSpeed | ( | int | speed | ) |
Change playback speed
| speed | the enum of playback speed |
| int io.agora.mediaplayer.IMediaPlayer.selectAudioTrack | ( | int | index | ) |
Select playback audio track of the media file
| index | the index of the audio track in media file |
| int io.agora.mediaplayer.IMediaPlayer.selectMultiAudioTrack | ( | int | playoutTrackIndex, |
| int | publishTrackIndex | ||
| ) |
Selects multi audio track of the media file for playback or publish to channel.
| playoutTrackIndex | The index of the audio track in media file for local playback. |
| publishTrackIndex | The index of the audio track in the media file published to the remote. |
| int io.agora.mediaplayer.IMediaPlayer.setPlayerOption | ( | String | key, |
| int | value | ||
| ) |
change player option before play a file
| key | the key of the option param |
| value | the value of option param |
| int io.agora.mediaplayer.IMediaPlayer.setPlayerOptionString | ( | String | key, |
| String | value | ||
| ) |
change player option before play a file
| key | the key of the option param |
| value | the value of option param |
| int io.agora.mediaplayer.IMediaPlayer.takeScreenshot | ( | String | filename | ) |
take screenshot while playing video
| filename | the filename of screenshot file |
| int io.agora.mediaplayer.IMediaPlayer.selectInternalSubtitle | ( | int | index | ) |
select internal subtitles in video
| index | the index of the internal subtitles |
| int io.agora.mediaplayer.IMediaPlayer.setExternalSubtitle | ( | String | url | ) |
set an external subtitle for video
| url | The URL of the subtitle file that you want to load. |
| int io.agora.mediaplayer.IMediaPlayer.adjustPublishSignalVolume | ( | int | volume | ) |
adjust publish signal volume
| int io.agora.mediaplayer.IMediaPlayer.getPublishSignalVolume | ( | ) |
get publish signal volume
| String io.agora.mediaplayer.IMediaPlayer.getPlaySrc | ( | ) |
Gets the url of the current play media file for publishing.
Implemented in io.agora.musiccontentcenter.IAgoraMusicPlayer.
| int io.agora.mediaplayer.IMediaPlayer.switchSrc | ( | String | src, |
| boolean | syncPts | ||
| ) |
switch to another play source
| src | The URL of the source |
| syncPts | whether to sync pts for the other source |
| int io.agora.mediaplayer.IMediaPlayer.preloadSrc | ( | String | src, |
| long | startPos | ||
| ) |
preload another play source
| src | The URL of the source |
| startPos | play pos of the preload source |
| int io.agora.mediaplayer.IMediaPlayer.playPreloadedSrc | ( | String | src | ) |
play the preloaded source
| src | The URL of the source |
| int io.agora.mediaplayer.IMediaPlayer.unloadSrc | ( | String | src | ) |
Unload a preloaded media source
| src | Specific src. |
| int io.agora.mediaplayer.IMediaPlayer.destroy | ( | ) |
Implemented in io.agora.musiccontentcenter.IAgoraMusicPlayer.
| int io.agora.mediaplayer.IMediaPlayer.registerPlayerObserver | ( | IMediaPlayerObserver | playerObserver | ) |
Registers a media player observer.
Once the media player observer is registered, you can use the observer to monitor the state change of the media player.
| playerObserver | The pointer to the IMediaPlayerObserver object. |
| int io.agora.mediaplayer.IMediaPlayer.unRegisterPlayerObserver | ( | IMediaPlayerObserver | playerObserver | ) |
Releases the media player observer.
| playerObserver | The pointer to the IMediaPlayerObserver object. |
| int io.agora.mediaplayer.IMediaPlayer.registerMediaPlayerAudioSpectrumObserver | ( | IAudioSpectrumObserver | observer, |
| int | intervalInMS | ||
| ) |
Registers the audio frame spectrum observer.
| observer | The pointer to the IAudioSpectrumObserver object. |
| int io.agora.mediaplayer.IMediaPlayer.unregisterMediaPlayerAudioSpectrumObserver | ( | IAudioSpectrumObserver | observer | ) |
Releases the audio frame spectrum observer.
| observer | The pointer to the IAudioSpectrumObserver object. |
| int io.agora.mediaplayer.IMediaPlayer.setAudioDualMonoMode | ( | int | mode | ) |
Set dual-mono output mode of the music file.
| mode | See AudioDualMonoMode. Default in AUDIO_DUAL_MONO_STEREO |
| int io.agora.mediaplayer.IMediaPlayer.openWithAgoraCDNSrc | ( | String | src, |
| long | startPos | ||
| ) |
Open the Agora CDN media source.
| src | The src of the media file that you want to play. |
| startPos | The playback position (ms). |
| int io.agora.mediaplayer.IMediaPlayer.getAgoraCDNLineCount | ( | ) |
Gets the number of Agora CDN lines.
| int io.agora.mediaplayer.IMediaPlayer.switchAgoraCDNLineByIndex | ( | int | index | ) |
Switch Agora CDN lines.
| index | Specific CDN line index. |
| int io.agora.mediaplayer.IMediaPlayer.getCurrentAgoraCDNIndex | ( | ) |
Gets the line of the current CDN.
| int io.agora.mediaplayer.IMediaPlayer.enableAutoSwitchAgoraCDN | ( | boolean | enable | ) |
Enable automatic CDN line switching.
| enable | Whether enable. |
| int io.agora.mediaplayer.IMediaPlayer.renewAgoraCDNSrcToken | ( | String | token, |
| long | ts | ||
| ) |
Update the CDN source token and timestamp.
| token | token. |
| ts | ts. |
| int io.agora.mediaplayer.IMediaPlayer.switchAgoraCDNSrc | ( | String | src, |
| boolean | syncPts | ||
| ) |
Switch the CDN source.
| src | Specific src. |
| syncPts | Live streaming must be set to false. |
| int io.agora.mediaplayer.IMediaPlayer.setSpatialAudioParams | ( | SpatialAudioParams | params | ) |
Set spatial audio params for the music file. It can be called after the media player was created.
| params | See SpatialAudioParams. If it's not set, then the spatial audio will be disabled; or it will be enabled. |
1.8.18