Class MediaPlayerControl
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
AudioStreamCount
Gets the number of available audio streams.
public int AudioStreamCount { get; }
Property Value
AudioStreamIndex
Gets or sets the index of the currently selected audio stream.
public int AudioStreamIndex { get; set; }
Property Value
AutoPlay
Gets or sets whether playback starts automatically when a source is set.
public bool AutoPlay { get; set; }
Property Value
Balance
Gets or sets the audio balance between left and right channels.
public float Balance { get; set; }
Property Value
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
CanPause
Gets whether the current media source supports pausing.
public bool CanPause { get; }
Property Value
CanSeek
Gets whether the current media source supports seeking.
public bool CanSeek { get; }
Property Value
CurrentState
Gets the current player state.
public PlayerState CurrentState { get; }
Property Value
CurrentStatistics
Gets current network statistics
public NetworkStat CurrentStatistics { get; }
Property Value
Duration
Gets the total duration of the media.
public TimeSpan Duration { get; }
Property Value
EchoCanceller
Gets or sets echo canceller. Should be set only when two-way communication is used.
public IEchoCanceller EchoCanceller { get; set; }
Property Value
InstanceId
Gets the unique identifier for this player instance.
public Guid InstanceId { get; }
Property Value
IsFullScreen
Gets or sets whether the player is in full screen mode.
public bool IsFullScreen { get; set; }
Property Value
IsLooping
Gets or sets whether playback loops when the end of media is reached.
public bool IsLooping { get; set; }
Property Value
IsMuted
Gets or sets whether audio is muted.
public bool IsMuted { get; set; }
Property Value
PlaybackParameters
Gets or sets the playback parameters.
public PlaybackParameters PlaybackParameters { get; set; }
Property Value
PlaybackRate
Gets or sets the playback rate. Normal speed is 1.0.
public double PlaybackRate { get; set; }
Property Value
PlayerBackgroundColor
Gets or sets the background color as an ARGB hex string.
public string PlayerBackgroundColor { get; set; }
Property Value
Position
Gets or sets the current playback position.
public TimeSpan Position { get; set; }
Property Value
ShowPlaybackControls
Gets or sets whether playback controls are shown on hover.
public bool ShowPlaybackControls { get; set; }
Property Value
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
Stat
Gets or sets the statistics text to display.
public string Stat { get; set; }
Property Value
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
StatIsVisible
Gets or sets whether the statistics display is visible.
public bool StatIsVisible { get; set; }
Property Value
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
Stretch
Gets or sets how the video is stretched to fit the display area.
public StretchType Stretch { get; set; }
Property Value
SubtitleDecoration
Gets or sets the subtitle styling options.
public SubtitleDecoration SubtitleDecoration { get; set; }
Property Value
SubtitleStreamCount
Gets the number of available subtitle streams.
public int SubtitleStreamCount { get; }
Property Value
SubtitleStreamIndex
Gets or sets the index of the currently selected subtitle stream.
public int SubtitleStreamIndex { get; set; }
Property Value
Title
Gets or sets the title text to display.
public string Title { get; set; }
Property Value
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
TitleIsVisible
Gets or sets whether the title display is visible.
public bool TitleIsVisible { get; set; }
Property Value
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
VideoStreamCount
Gets the number of available video streams.
public int VideoStreamCount { get; }
Property Value
VideoStreamIndex
Gets or sets the index of the currently selected video stream.
public int VideoStreamIndex { get; set; }
Property Value
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
Methods
Dispose()
Release resources
public void Dispose()
GetAudioMediaType(int)
Gets the media type of the specified audio stream.
public MediaType GetAudioMediaType(int streamIndex)
Parameters
streamIndexintThe audio stream index.
Returns
GetSubtitleMediaType(int)
Gets the media type of the specified subtitle stream.
public MediaType GetSubtitleMediaType(int streamIndex)
Parameters
streamIndexintThe subtitle stream index.
Returns
GetVideoMediaType(int)
Gets the media type of the specified video stream.
public MediaType GetVideoMediaType(int streamIndex)
Parameters
streamIndexintThe video stream index.
Returns
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
Events
CurrentStateChanged
Current state changed
public event EventHandler<PlayerState> CurrentStateChanged
Event Type
MediaEnded
Media ended
public event EventHandler MediaEnded
Event Type
MediaFailed
Critical error
public event EventHandler<ErrorEventArgs> MediaFailed
Event Type
MediaOpened
Media has been opened
public event EventHandler MediaOpened
Event Type
SeekCompleted
Seek has been completed
public event EventHandler SeekCompleted
Event Type
VideoRenderingStarted
Video rendering has been started
public event EventHandler VideoRenderingStarted