Agora Java API Reference for Android
Public Member Functions | List of all members
agora::rtc::IMediaPlayerSourceObserver Class Referenceabstract

#include <IAgoraMediaPlayerSource.h>

Public Member Functions

virtual void onPlayerSourceStateChanged (media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason)=0
 Reports the changes of playback state. More...
 
virtual void onPositionChanged (int64_t positionMs, int64_t timestampMs)=0
 Reports the playback progress of the media file. More...
 
virtual void onPlayerEvent (media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char *message)=0
 Reports the player events. More...
 
virtual void onMetaData (const void *data, int length)=0
 Occurs when the media metadata is received. More...
 
virtual void onPlayBufferUpdated (int64_t playCachedBuffer)=0
 Reports the playback duration that the buffered data can support. More...
 
virtual void onPreloadEvent (const char *src, media::base::PLAYER_PRELOAD_EVENT event)=0
 Reports the events of preloaded media resources. More...
 
virtual void onCompleted ()=0
 Occurs when one playback of the media file is completed.
 
virtual void onAgoraCDNTokenWillExpire ()=0
 AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* src). More...
 
virtual void onPlayerSrcInfoChanged (const media::base::SrcInfo &from, const media::base::SrcInfo &to)=0
 Occurs when the video bitrate of the media resource changes. More...
 
virtual void onPlayerInfoUpdated (const media::base::PlayerUpdatedInfo &info)=0
 Occurs when information related to the media player changes. More...
 
virtual void onPlayerCacheStats (const media::base::CacheStatistics &stats)
 Reports the statistics of the media file being cached. More...
 
virtual void onPlayerPlaybackStats (const media::base::PlayerPlaybackStats &stats)
 The statistics of the media file being played. More...
 
virtual void onAudioVolumeIndication (int volume)=0
 Reports the volume of the media player. More...
 

Detailed Description

This class class reports runtime events to the applications.

Member Function Documentation

◆ onPlayerSourceStateChanged()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPlayerSourceStateChanged ( media::base::MEDIA_PLAYER_STATE  state,
media::base::MEDIA_PLAYER_REASON  reason 
)
pure virtual

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.

Parameters
stateThe playback state. See MEDIA_PLAYER_STATE.
reasonThe reason for the changes in the media player status. See MEDIA_PLAYER_REASON.

◆ onPositionChanged()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPositionChanged ( int64_t  positionMs,
int64_t  timestampMs 
)
pure virtual

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.

Parameters
positionMsThe playback position (ms) of media files.
timeStampMsThe NTP timestamp (ms) of the current playback progress.

◆ onPlayerEvent()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPlayerEvent ( media::base::MEDIA_PLAYER_EVENT  eventCode,
int64_t  elapsedTime,
const char *  message 
)
pure virtual

Reports the player events.

  • After calling the seek method, the SDK triggers the callback to report the results of the seek operation.
Parameters
eventCodeThe player event. See MEDIA_PLAYER_EVENT.
elapsedTimeThe time (ms) when the event occurs.
messageInformation about the event.

◆ onMetaData()

virtual void agora::rtc::IMediaPlayerSourceObserver::onMetaData ( const void *  data,
int  length 
)
pure virtual

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.

Parameters
dataThe detailed data of the media metadata.
lengthThe data length (bytes).

◆ onPlayBufferUpdated()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPlayBufferUpdated ( int64_t  playCachedBuffer)
pure virtual

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.

  • When the playback duration supported by the buffered data is less than the threshold (0 by default), the SDK returns PLAYER_EVENT_BUFFER_LOW (6).
  • When the playback duration supported by the buffered data is greater than the threshold (0 by default), the SDK returns PLAYER_EVENT_BUFFER_RECOVER (7).
Parameters
playCachedBufferThe playback duration (ms) that the buffered data can support.

◆ onPreloadEvent()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPreloadEvent ( const char *  src,
media::base::PLAYER_PRELOAD_EVENT  event 
)
pure virtual

Reports the events of preloaded media resources.

Parameters
srcThe URL of the media resource.
eventEvents that occur when media resources are preloaded. See PLAYER_PRELOAD_EVENT.

◆ onAgoraCDNTokenWillExpire()

virtual void agora::rtc::IMediaPlayerSourceObserver::onAgoraCDNTokenWillExpire ( )
pure virtual

AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* src).

Deprecated:
4.6.0

◆ onPlayerSrcInfoChanged()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPlayerSrcInfoChanged ( const media::base::SrcInfo from,
const media::base::SrcInfo to 
)
pure virtual

Occurs when the video bitrate of the media resource changes.

Parameters
fromInformation about the video bitrate of the media resource being played. See SrcInfo.
toInformation about the changed video bitrate of media resource being played. See SrcInfo.

◆ onPlayerInfoUpdated()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPlayerInfoUpdated ( const media::base::PlayerUpdatedInfo info)
pure virtual

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.

Parameters
infoInformation related to the media player. See PlayerUpdatedInfo.

◆ onPlayerCacheStats()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPlayerCacheStats ( const media::base::CacheStatistics stats)
virtual

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.

Parameters
statsThe statistics of the media file being cached. See CacheStatistics.

◆ onPlayerPlaybackStats()

virtual void agora::rtc::IMediaPlayerSourceObserver::onPlayerPlaybackStats ( const media::base::PlayerPlaybackStats stats)
virtual

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.

Parameters
statsThe statistics of the media file. See PlayerPlaybackStats.

◆ onAudioVolumeIndication()

virtual void agora::rtc::IMediaPlayerSourceObserver::onAudioVolumeIndication ( int  volume)
pure virtual

Reports the volume of the media player.

The SDK triggers this callback every 200 milliseconds to report the current volume of the media player.

Parameters
volumeThe volume of the media player. The value ranges from 0 to 255.