Agora RTC Objective-C API Reference  Refactor
Public Member Functions
IMediaPlayerSourceObserver Class Referenceabstract

Public Member Functions

virtual void onPlayerSourceStateChanged (media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason)=0
 
virtual void onPositionChanged (int64_t positionMs, int64_t timestampMs)=0
 
virtual void onPlayerEvent (media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char *message)=0
 
virtual void onMetaData (const void *data, int length)=0
 
virtual void onPlayBufferUpdated (int64_t playCachedBuffer)=0
 
virtual void onPreloadEvent (const char *src, media::base::PLAYER_PRELOAD_EVENT event)=0
 
virtual void onAgoraCDNTokenWillExpire ()=0
 
virtual void onPlayerSrcInfoChanged (const media::base::SrcInfo &from, const media::base::SrcInfo &to)=0
 
virtual void onPlayerInfoUpdated (const media::base::PlayerUpdatedInfo &info)=0
 
virtual void onPlayerCacheStats (const media::base::CacheStatistics &stats)
 
virtual void onPlayerPlaybackStats (const media::base::PlayerPlaybackStats &stats)
 
virtual void onAudioVolumeIndication (int volume)=0
 

Detailed Description

This class class reports runtime events to the applications.

Constructor & Destructor Documentation

◆ ~IMediaPlayerSourceObserver()

virtual ~IMediaPlayerSourceObserver ( )
inlinevirtual

Member Function Documentation

◆ onPlayerSourceStateChanged()

virtual void 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 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 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 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 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 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.

◆ onCompleted()

virtual void onCompleted ( )
pure virtual

Occurs when one playback of the media file is completed.

◆ onAgoraCDNTokenWillExpire()

virtual void 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 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 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 onPlayerCacheStats ( const media::base::CacheStatistics stats)
inlinevirtual

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 onPlayerPlaybackStats ( const media::base::PlayerPlaybackStats stats)
inlinevirtual

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 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.