|
Agora Java API Reference for Android
|
Public Member Functions | |
| void | onPlayerStateChanged (Constants.MediaPlayerState state, Constants.MediaPlayerReason reason) |
| Reports the changes of playback state. More... | |
| void | onPositionChanged (long positionMs, long timestampMs) |
| Reports the playback progress of the media file. More... | |
| void | onPlayerEvent (Constants.MediaPlayerEvent eventCode, long elapsedTime, String message) |
| Reports the player events. More... | |
| void | onMetaData (Constants.MediaPlayerMetadataType type, byte[] data) |
| Occurs when the media metadata is received. More... | |
| void | onPlayBufferUpdated (long playCachedBuffer) |
| Reports the playback duration that the buffered data can support. More... | |
| void | onPreloadEvent (String src, Constants.MediaPlayerPreloadEvent event) |
| Reports the events of preloaded media resources. More... | |
| void | onAgoraCDNTokenWillExpire () |
| AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken. More... | |
| void | onPlayerSrcInfoChanged (SrcInfo from, SrcInfo to) |
| Occurs when the video bitrate of the media resource changes. More... | |
| void | onPlayerInfoUpdated (PlayerUpdatedInfo info) |
| Occurs when information related to the media player changes. More... | |
| void | onPlayerCacheStats (CacheStatistics stats) |
| Reports the statistics of the media file being cached. More... | |
| void | onPlayerPlaybackStats (PlayerPlaybackStats stats) |
| Reports the statistics of the media file being played. More... | |
| void | onAudioVolumeIndication (int volume) |
| Reports the volume of the media player. More... | |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPlayerStateChanged | ( | Constants.MediaPlayerState | state, |
| Constants.MediaPlayerReason | reason | ||
| ) |
Reports the changes of playback state.
When the state of the media player changes, the SDK triggers this callback to report the current playback state.
| state | The playback state. See MediaPlayerState. |
| reason | The reason for the changes in the media player status. See MediaPlayerReason. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPositionChanged | ( | long | positionMs, |
| long | timestampMs | ||
| ) |
Reports the playback progress of the media file.
When playing media files, the SDK triggers this callback every two second to report current playback progress.
| positionMs | The playback position (ms) of media files. |
| timeStampMs | The NTP timestamp (ms) of the current playback progress. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPlayerEvent | ( | Constants.MediaPlayerEvent | eventCode, |
| long | elapsedTime, | ||
| String | message | ||
| ) |
Reports the player events.
seek method, the SDK triggers the callback to report the results of the seek operation.| eventCode | The player event. See MediaPlayerEvent. |
| elapsedTime | The time (ms) when the event occurs. |
| message | Information about the event. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onMetaData | ( | Constants.MediaPlayerMetadataType | type, |
| byte[] | data | ||
| ) |
Occurs when the media metadata is received.
The callback occurs when the player receives the media metadata and reports the detailed information of the media metadata.
| type | The type of media metadata. See MediaPlayerMetadataType. |
| data | The detailed data of the media metadata. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPlayBufferUpdated | ( | long | playCachedBuffer | ) |
Reports the playback duration that the buffered data can support.
When playing online media resources, the SDK triggers this callback every two seconds to report the playback duration that the currently buffered data can support.
PLAYER_EVENT_BUFFER_LOW (6).PLAYER_EVENT_BUFFER_RECOVER (7).| playCachedBuffer | The playback duration (ms) that the buffered data can support. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPreloadEvent | ( | String | src, |
| Constants.MediaPlayerPreloadEvent | event | ||
| ) |
Reports the events of preloaded media resources.
| src | The URL of the media resource. |
| event | Events that occur when media resources are preloaded. See MediaPlayerPreloadEvent. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onAgoraCDNTokenWillExpire | ( | ) |
AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken.
Occurs when the video bitrate of the media resource changes.
| from | Information about the video bitrate of the media resource being played. See SrcInfo. |
| to | Information about the changed video bitrate of media resource being played. See SrcInfo. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPlayerInfoUpdated | ( | PlayerUpdatedInfo | info | ) |
Occurs when information related to the media player changes.
When the information about the media player changes, the SDK triggers this callback. You can use this callback for troubleshooting.
| info | Information related to the media player. See PlayerUpdatedInfo. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPlayerCacheStats | ( | CacheStatistics | stats | ) |
Reports the statistics of the media file being cached.
After you call the openWithMediaSource method and set enableCache as true, the SDK triggers this callback once per second to report the statistics of the media file being cached.
| stats | The statistics of the media file being cached. See CacheStatistics. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onPlayerPlaybackStats | ( | PlayerPlaybackStats | stats | ) |
Reports the statistics of the media file being played.
The SDK triggers this callback once per second to report the statistics of the media file being played.
| stats | The statistics of the media file. See PlayerPlaybackStats. |
| void io.agora.mediaplayer.IMediaPlayerObserver.onAudioVolumeIndication | ( | int | volume | ) |
Reports the volume of the media player.
The SDK triggers this callback every 200 milliseconds to report the current volume of the media player.
| volume | The volume of the media player. The value ranges from 0 to 255. |
1.8.18