Media Player Kit v1.3.0 API Reference for Windows
Public Member Functions | List of all members
agora::rtc::IMediaPlayerObserver Class Referenceabstract

Public Member Functions

virtual void onPlayerStateChanged (media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec)=0
 
virtual void onPositionChanged (const int64_t position_ms)=0
 
virtual void onPlayerEvent (media::base::MEDIA_PLAYER_EVENT event)=0
 
virtual void onMetadata (media::base::MEDIA_PLAYER_METADATA_TYPE type, const uint8_t *data, uint32_t length)=0
 
virtual void onPreloadEvent (const char *src, media::base::PLAYER_PRELOAD_EVENT event)=0
 
virtual void onPlayBufferUpdated (int64_t playCachedBuffer)=0
 
virtual ~IMediaPlayerObserver ()
 

Detailed Description

The IMediaPlayerObserver class.

Constructor & Destructor Documentation

◆ ~IMediaPlayerObserver()

virtual agora::rtc::IMediaPlayerObserver::~IMediaPlayerObserver ( )
inlinevirtual

Member Function Documentation

◆ onPlayerStateChanged()

virtual void agora::rtc::IMediaPlayerObserver::onPlayerStateChanged ( media::base::MEDIA_PLAYER_STATE  state,
media::base::MEDIA_PLAYER_ERROR  ec 
)
pure virtual

Reports the playback state change.

When the state of the playback changes, the MediaPlayer Kit occurs this callback to report the new playback state and the reason or error for the change.

Parameters
stateThe new playback state after change. See MEDIA_PLAYER_STATE
ecThe player's error code. See MEDIA_PLAYER_ERROR

◆ onPositionChanged()

virtual void agora::rtc::IMediaPlayerObserver::onPositionChanged ( const int64_t  position_ms)
pure virtual

Reports current playback progress.

The callback occurs once every one second during the playback and reports current playback progress.

Parameters
positionCurrent playback progress (ms).

◆ onPlayerEvent()

virtual void agora::rtc::IMediaPlayerObserver::onPlayerEvent ( media::base::MEDIA_PLAYER_EVENT  event)
pure virtual

Reports the playback event.

  • After calling the seek method, the MediaPlayer Kit occurs the callback to report the results of the seek operation.
  • After calling the selectAudioTrack method, the MediaPlayer Kit occurs the callback to report that the audio track changes.
  • After calling the switchSrc method, the MediaPlayer Kit occurs the callback to report the results of the switch operation.
    Parameters
    eventThe playback event. See MEDIA_PLAYER_EVENT for details.

◆ onMetadata()

virtual void agora::rtc::IMediaPlayerObserver::onMetadata ( media::base::MEDIA_PLAYER_METADATA_TYPE  type,
const uint8_t *  data,
uint32_t  length 
)
pure virtual

Reports the reception of the media metadata.

The callback occurs when the player receivers the media metadata and reports the detailed information of the media metadata.

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

◆ onPreloadEvent()

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

Reports the events for preloading media resources.

Parameters
srcPreloaded media resource URL address
eventEvents that occur when media resources are preloaded. See PLAYER_PRELOAD_EVENT for details.

◆ onPlayBufferUpdated()

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

Reports the playback duration that the buffered data can support.

In the process of playing online media resources, the mediaplayer kit triggers this callback every one second 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 mediaplayer kit returns PLAYER_EVENT_BUFFER_LOW(6).
  • When the playback duration supported by the buffered data is greater than the threshold (0 by default), the mediaplayer kit returns PLAYER_EVENT_BUFFER_RECOVER(7).
    Parameters
    playCachedBufferThe playback duration (ms) that the buffered data can support.