using System;
namespace Agora.Rtc
{
///
///
/// Provides callbacks for media players.
///
///
public abstract class IMediaPlayerSourceObserver
{
///
///
/// Reports the playback state change.
/// When the state of the media player changes, the SDK triggers this Callback to report the current playback state.
///
///
/// The playback state, see MEDIA_PLAYER_STATE .
///
/// The error code. See MEDIA_PLAYER_ERROR .
///
public virtual void OnPlayerSourceStateChanged(MEDIA_PLAYER_STATE state, MEDIA_PLAYER_ERROR ec) { }
///
///
/// Reports current playback progress.
/// When playing media files, the SDK triggers this Callback every one second to report current playback progress.
///
///
/// The playback position (ms) of media files.
///
public virtual void OnPositionChanged(Int64 position_ms) { }
///
///
/// Reports the playback event.
/// After calling the Seek method, the SDK triggers the Callback to report the results of the seek operation.
///
///
/// The playback event. See MEDIA_PLAYER_EVENT .
///
/// The time (ms) when the event occurs.
///
/// Information about the event.
///
public virtual void OnPlayerEvent(MEDIA_PLAYER_EVENT eventCode, Int64 elapsedTime, string message) { }
///
///
/// 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.
///
///
/// The detailed data of the media metadata.
///
/// The data length (bytes).
///
public virtual void OnMetaData(byte[] data, int length) { }
///
///
/// 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.When the playback duration supported by the buffered data is greater than the threshold (0 by default), the SDK returns PLAYER_EVENT_BUFFER_RECOVER.
///
///
/// The playback duration (ms) that the buffered data can support.
///
public virtual void OnPlayBufferUpdated(Int64 playCachedBuffer) { }
///
///
/// Reports the events of preloaded media resources.
///
///
/// The URL of the media resource.
///
/// Events that occur when media resources are preloaded. See PLAYER_PRELOAD_EVENT .
///
public virtual void OnPreloadEvent(string src, PLAYER_PRELOAD_EVENT @event) { }
///
///
/// Occurs when the media file is played once.
///
///
public virtual void OnCompleted() { }
///
///
/// Occurs when the token is about to expire.
/// If the ts is about to expire when you call the SwitchAgoraCDNLineByIndex method to switch the CDN route for playing the media resource, the SDK triggers this Callback to remind you to renew the authentication information. You need to call the RenewAgoraCDNSrcToken method to pass in the updated authentication information to update the authentication information of the media resource URL. After updating the authentication information, you need to call SwitchAgoraCDNLineByIndex to complete the route switching.
///
///
public virtual void OnAgoraCDNTokenWillExpire() { }
///
///
/// Occurs when the video bitrate of the media resource changes.
///
///
/// Information about the video bitrate of the media resource being played. See SrcInfo .
///
/// Information about the changed video bitrate of media resource being played. See SrcInfo .
///
public virtual void OnPlayerSrcInfoChanged(SrcInfo from, SrcInfo to) { }
///
///
/// 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.
///
///
/// Information related to the media player. See PlayerUpdatedInfo .
///
public virtual void OnPlayerInfoUpdated(PlayerUpdatedInfo info) { }
///
///
/// Reports the volume of the media player.
/// The SDK triggers this Callback every 200 milliseconds to report the current volume of the media player.
///
///
/// The volume of the media player. The value ranges from 0 to 255.
///
public virtual void OnAudioVolumeIndication(int volume) { }
}
}