Interface IMediaPlayer
Defines the contract for a media player that can play audio and video content.
public interface IMediaPlayer : IDisposable
- Inherited Members
Properties
AbsolutePlaybackTime
Gets the absolute playback time if available from the media source.
DateTime? AbsolutePlaybackTime { get; }
Property Value
AudioStreamCount
Gets the number of available audio streams.
int AudioStreamCount { get; }
Property Value
AudioStreamIndex
Gets or sets the index of the audio stream currently being rendered.
int AudioStreamIndex { get; set; }
Property Value
AutoPlay
Gets or sets a value indicating whether playback starts automatically when URI or IMediaSource is assigned.
bool AutoPlay { get; set; }
Property Value
Balance
Gets or sets the audio balance between left and right channels.
float Balance { get; set; }
Property Value
CanPause
Gets a value indicating whether the media can be paused.
bool CanPause { get; }
Property Value
CanSeek
Gets a value indicating whether the media supports seeking.
bool CanSeek { get; }
Property Value
CurrentState
Gets the current player state.
PlayerState CurrentState { get; }
Property Value
CurrentStatistics
Gets the current network statistics.
NetworkStat CurrentStatistics { get; }
Property Value
Duration
Gets the total duration of the media.
TimeSpan Duration { get; }
Property Value
EchoCanceller
Gets or sets the echo canceller for two-way communication scenarios.
IEchoCanceller EchoCanceller { get; set; }
Property Value
InstanceId
Gets the unique identifier for this player instance.
Guid InstanceId { get; }
Property Value
IsFullScreen
Gets or sets a value indicating whether the player is in fullscreen mode.
bool IsFullScreen { get; set; }
Property Value
IsLooping
Gets or sets a value indicating whether playback should loop continuously.
bool IsLooping { get; set; }
Property Value
IsMuted
Gets or sets a value indicating whether the audio is muted.
bool IsMuted { get; set; }
Property Value
PlaybackParameters
Gets or sets the playback parameters.
PlaybackParameters PlaybackParameters { get; set; }
Property Value
PlaybackRate
Gets or sets the playback rate multiplier.
double PlaybackRate { get; set; }
Property Value
PlayerBackgroundColor
Gets or sets the player background color as a hexadecimal string. Acceptable formats: #AARRGGBB, #RRGGBB, AARRGGBB, RRGGBB. Examples: #FFFFFFFF, #FFFF00, FFFF0000, FF0000. The default value is #FF000000 (black).
string PlayerBackgroundColor { get; set; }
Property Value
Position
Gets or sets the current playback position.
TimeSpan Position { get; set; }
Property Value
Source
Gets or sets the media source URI.
Uri Source { get; set; }
Property Value
- Uri
SourceMedia
Gets or sets the media source object directly.
IMediaSource SourceMedia { get; set; }
Property Value
Stretch
Gets or sets the video stretch mode.
StretchType Stretch { get; set; }
Property Value
SubtitleStreamCount
Gets the number of available subtitle streams.
int SubtitleStreamCount { get; }
Property Value
SubtitleStreamIndex
Gets or sets the index of the subtitle stream currently being rendered.
int SubtitleStreamIndex { get; set; }
Property Value
VideoStreamCount
Gets the number of available video streams.
int VideoStreamCount { get; }
Property Value
VideoStreamIndex
Gets or sets the index of the video stream currently being rendered.
int VideoStreamIndex { get; set; }
Property Value
Volume
Gets or sets the audio volume level.
float Volume { get; set; }
Property Value
Methods
GetAudioMediaType(int)
Gets the media type of the audio stream at the specified index.
MediaType GetAudioMediaType(int streamIndex)
Parameters
streamIndexintThe index of the audio stream.
Returns
- MediaType
The media type of the audio stream.
GetSubtitleMediaType(int)
Gets the media type of the subtitle stream at the specified index.
MediaType GetSubtitleMediaType(int streamIndex)
Parameters
streamIndexintThe index of the subtitle stream.
Returns
- MediaType
The media type of the subtitle stream.
GetVideoMediaType(int)
Gets the media type of the video stream at the specified index.
MediaType GetVideoMediaType(int streamIndex)
Parameters
streamIndexintThe index of the video stream.
Returns
- MediaType
The media type of the video stream.
Pause()
Pauses media playback.
void Pause()
Play()
Starts or resumes media playback.
void Play()
Stop()
Stops media playback and resets the position.
void Stop()
TakeSnapshot()
Takes a JPEG image snapshot of the current video frame.
Task<Stream> TakeSnapshot()
Returns
Events
CurrentStateChanged
Occurs when the current player state changes.
event EventHandler<PlayerState> CurrentStateChanged
Event Type
MediaEnded
Occurs when the media playback has ended.
event EventHandler MediaEnded
Event Type
MediaFailed
Occurs when a critical error prevents media playback.
event EventHandler<ErrorEventArgs> MediaFailed
Event Type
MediaOpened
Occurs when the media has been successfully opened.
event EventHandler MediaOpened
Event Type
SeekCompleted
Occurs when a seek operation has been completed.
event EventHandler SeekCompleted
Event Type
VideoRenderingStarted
Occurs when video rendering has started.
event EventHandler VideoRenderingStarted