IMediaPlayerSourceObserver

Provides callbacks for media players.

OnAudioVolumeIndication

Reports the volume of the media player.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
void OnAudioVolumeIndication(int volume);

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.

OnMetaData

Occurs when the media metadata is received.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnMetaData(const FString& Data);

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

Reports the playback duration that the buffered data can support.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPlayBufferUpdated(int64 playCachedBuffer);
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.

OnPlayerCacheStats

Reports the statistics of the media file being cached.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPlayerCacheStats(const FCacheStatistics& stats);

Details

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

OnPlayerEvent

Reports the player events.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPlayerEvent(EMEDIA_PLAYER_EVENT eventCode, int64 elapsedTime, const FString& message);
  • After calling the Seek method, the SDK triggers the callback to report the results of the seek operation.

Parameters

eventCode
The player event. See EMEDIA_PLAYER_EVENT.
elapsedTime
The time (ms) when the event occurs.
message
Information about the event.

OnPlayerInfoUpdated

Occurs when information related to the media player changes.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPlayerInfoUpdated(const FPlayerUpdatedInfo& info);

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

OnPlayerPlaybackStats

The statistics of the media file being played.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPlayerPlaybackStats(const FPlayerPlaybackStats& stats);

Details

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

OnPlayerSourceStateChanged

Reports the changes of playback state.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPlayerSourceStateChanged(EMEDIA_PLAYER_STATE state, FENUMWRAP_MEDIA_PLAYER_REASON ec);

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 EMEDIA_PLAYER_STATE.
reason
The reason for the changes in the media player status. See FENUMWRAP_MEDIA_PLAYER_REASON.

OnPlayerSrcInfoChanged

Occurs when the video bitrate of the media resource changes.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPlayerSrcInfoChanged(const FSrcInfo& from, const FSrcInfo& to);

Parameters

from
Information about the video bitrate of the media resource being played. See FSrcInfo.
to
Information about the changed video bitrate of media resource being played. See FSrcInfo.

OnPositionChanged

Reports the playback progress of the media file.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPositionChanged(int64 position_ms, int64 timestampMs);

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.

OnPreloadEvent

Reports the events of preloaded media resources.

UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
	void OnPreloadEvent(const FString& src, EPLAYER_PRELOAD_EVENT event);

Parameters

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