Table of Contents

Class MediaPlayerControl

Namespace
VAST.Controls
Assembly
VAST.UI.dll

MAUI ContentView control for media playback with optional playback controls. Wraps MediaPlayerControlBase and adds UI controls for play, pause, and looping.

public class MediaPlayerControl : ContentView, IMediaPlayer, IDisposable
Inheritance
MediaPlayerControl
Implements

Constructors

MediaPlayerControl()

Creates a new instance of MediaPlayerControl.

public MediaPlayerControl()

Properties

AbsolutePlaybackTime

Gets the absolute playback time when playing streams with absolute timestamps.

public DateTime? AbsolutePlaybackTime { get; }

Property Value

DateTime?

AudioStreamCount

Gets the number of available audio streams.

public int AudioStreamCount { get; }

Property Value

int

AudioStreamIndex

Gets or sets the index of the currently selected audio stream.

public int AudioStreamIndex { get; set; }

Property Value

int

AutoPlay

Gets or sets whether playback starts automatically when a source is set.

public bool AutoPlay { get; set; }

Property Value

bool

Balance

Gets or sets the audio balance between left and right channels.

public float Balance { get; set; }

Property Value

float

BorderColor

Gets or sets the border color.

public Color BorderColor { get; set; }

Property Value

Color

BorderThickness

Gets or sets the border thickness.

public double BorderThickness { get; set; }

Property Value

double

CanPause

Gets whether the current media source supports pausing.

public bool CanPause { get; }

Property Value

bool

CanSeek

Gets whether the current media source supports seeking.

public bool CanSeek { get; }

Property Value

bool

CurrentState

Gets the current player state.

public PlayerState CurrentState { get; }

Property Value

PlayerState

CurrentStatistics

Gets current network statistics

public NetworkStat CurrentStatistics { get; }

Property Value

NetworkStat

Duration

Gets the total duration of the media.

public TimeSpan Duration { get; }

Property Value

TimeSpan

EchoCanceller

Gets or sets echo canceller. Should be set only when two-way communication is used.

public IEchoCanceller EchoCanceller { get; set; }

Property Value

IEchoCanceller

InstanceId

Gets the unique identifier for this player instance.

public Guid InstanceId { get; }

Property Value

Guid

IsFullScreen

Gets or sets whether the player is in full screen mode.

public bool IsFullScreen { get; set; }

Property Value

bool

IsLooping

Gets or sets whether playback loops when the end of media is reached.

public bool IsLooping { get; set; }

Property Value

bool

IsMuted

Gets or sets whether audio is muted.

public bool IsMuted { get; set; }

Property Value

bool

PlaybackParameters

Gets or sets the playback parameters.

public PlaybackParameters PlaybackParameters { get; set; }

Property Value

PlaybackParameters

PlaybackRate

Gets or sets the playback rate. Normal speed is 1.0.

public double PlaybackRate { get; set; }

Property Value

double

PlayerBackgroundColor

Gets or sets the background color as an ARGB hex string.

public string PlayerBackgroundColor { get; set; }

Property Value

string

Position

Gets or sets the current playback position.

public TimeSpan Position { get; set; }

Property Value

TimeSpan

ShowPlaybackControls

Gets or sets whether playback controls are shown on hover.

public bool ShowPlaybackControls { get; set; }

Property Value

bool

Source

Gets or sets the media source URI.

public Uri Source { get; set; }

Property Value

Uri

SourceMedia

Gets or sets the media source object directly.

public IMediaSource SourceMedia { get; set; }

Property Value

IMediaSource

Stat

Gets or sets the statistics text to display.

public string Stat { get; set; }

Property Value

string

StatBackColor

Gets or sets the background color for the statistics display.

public Color StatBackColor { get; set; }

Property Value

Color

StatColor

Gets or sets the text color for the statistics display.

public Color StatColor { get; set; }

Property Value

Color

StatFont

Gets or sets the font for the statistics display.

public Font StatFont { get; set; }

Property Value

Font

StatHeightRequest

Gets or sets the requested height for the statistics display.

public double StatHeightRequest { get; set; }

Property Value

double

StatIsVisible

Gets or sets whether the statistics display is visible.

public bool StatIsVisible { get; set; }

Property Value

bool

StatMargin

Gets or sets the margin for the statistics display.

public Thickness StatMargin { get; set; }

Property Value

Thickness

StatWidthRequest

Gets or sets the requested width for the statistics display.

public double StatWidthRequest { get; set; }

Property Value

double

Stretch

Gets or sets how the video is stretched to fit the display area.

public StretchType Stretch { get; set; }

Property Value

StretchType

SubtitleDecoration

Gets or sets the subtitle styling options.

public SubtitleDecoration SubtitleDecoration { get; set; }

Property Value

SubtitleDecoration

SubtitleStreamCount

Gets the number of available subtitle streams.

public int SubtitleStreamCount { get; }

Property Value

int

SubtitleStreamIndex

Gets or sets the index of the currently selected subtitle stream.

public int SubtitleStreamIndex { get; set; }

Property Value

int

Title

Gets or sets the title text to display.

public string Title { get; set; }

Property Value

string

TitleBackColor

Gets or sets the background color for the title display.

public Color TitleBackColor { get; set; }

Property Value

Color

TitleColor

Gets or sets the text color for the title display.

public Color TitleColor { get; set; }

Property Value

Color

TitleFont

Gets or sets the font for the title display.

public Font TitleFont { get; set; }

Property Value

Font

TitleHeightRequest

Gets or sets the requested height for the title display.

public double TitleHeightRequest { get; set; }

Property Value

double

TitleIsVisible

Gets or sets whether the title display is visible.

public bool TitleIsVisible { get; set; }

Property Value

bool

TitleMargin

Gets or sets the margin for the title display.

public Thickness TitleMargin { get; set; }

Property Value

Thickness

TitleWidthRequest

Gets or sets the requested width for the title display.

public double TitleWidthRequest { get; set; }

Property Value

double

VideoStreamCount

Gets the number of available video streams.

public int VideoStreamCount { get; }

Property Value

int

VideoStreamIndex

Gets or sets the index of the currently selected video stream.

public int VideoStreamIndex { get; set; }

Property Value

int

Volume

Gets or sets the audio volume. Value ranges from 0.0 (silent) to 1.0 (full volume).

public float Volume { get; set; }

Property Value

float

Methods

Dispose()

Release resources

public void Dispose()

GetAudioMediaType(int)

Gets the media type of the specified audio stream.

public MediaType GetAudioMediaType(int streamIndex)

Parameters

streamIndex int

The audio stream index.

Returns

MediaType

The MediaType of the audio stream, or null if not found.

GetSubtitleMediaType(int)

Gets the media type of the specified subtitle stream.

public MediaType GetSubtitleMediaType(int streamIndex)

Parameters

streamIndex int

The subtitle stream index.

Returns

MediaType

The MediaType of the subtitle stream, or null if not found.

GetVideoMediaType(int)

Gets the media type of the specified video stream.

public MediaType GetVideoMediaType(int streamIndex)

Parameters

streamIndex int

The video stream index.

Returns

MediaType

The MediaType of the video stream, or null if not found.

Pause()

Pauses playback if the media source supports pausing.

public void Pause()

Play()

Starts or resumes playback.

public void Play()

Stop()

Stops playback and releases resources.

public void Stop()

TakeSnapshot()

Takes a JPEG image snapshot and returns its stream

public Task<Stream> TakeSnapshot()

Returns

Task<Stream>

JPEG image data stream

Events

CurrentStateChanged

Current state changed

public event EventHandler<PlayerState> CurrentStateChanged

Event Type

EventHandler<PlayerState>

MediaEnded

Media ended

public event EventHandler MediaEnded

Event Type

EventHandler

MediaFailed

Critical error

public event EventHandler<ErrorEventArgs> MediaFailed

Event Type

EventHandler<ErrorEventArgs>

MediaOpened

Media has been opened

public event EventHandler MediaOpened

Event Type

EventHandler

SeekCompleted

Seek has been completed

public event EventHandler SeekCompleted

Event Type

EventHandler

VideoRenderingStarted

Video rendering has been started

public event EventHandler VideoRenderingStarted

Event Type

EventHandler