Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | List of all members
agora::rtc::IMediaPlayerSourceObserver Class Referenceabstract

`#include <IAgoraMediaPlayerSource.h>`

## Public Member Functions
virtual | ~IMediaPlayerSourceObserver ()
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 | onCompleted ()=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 agora::rtc::IMediaPlayerSourceObserver::~IMediaPlayerSourceObserver | ( |  | ) |
| inlinevirtual

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

  state | The playback state. See `MEDIA_PLAYER_STATE`.
  reason | The 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

  positionMs | The playback position (ms) of media files.
  timeStampMs | The 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

  eventCode | The player event. See `MEDIA_PLAYER_EVENT`.
  elapsedTime | The time (ms) when the event occurs.
  message | Information 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

  data | The detailed data of the media metadata.
  length | The 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

  playCachedBuffer | The 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

  src | The URL of the media resource.
  event | Events that occur when media resources are preloaded. See `PLAYER_PRELOAD_EVENT`.

## ◆ onCompleted()

virtual void agora::rtc::IMediaPlayerSourceObserver::onCompleted | ( |  | ) |
| pure virtual

Occurs when one playback of the media file is completed.

## ◆ 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

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

## ◆ 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

  info | Information related to the media player. See `PlayerUpdatedInfo`.

## ◆ onPlayerCacheStats()

virtual void agora::rtc::IMediaPlayerSourceObserver::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

  stats | The statistics of the media file being cached. See `CacheStatistics`.

## ◆ onPlayerPlaybackStats()

virtual void agora::rtc::IMediaPlayerSourceObserver::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

  stats | The 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

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