Class MediaPlayerControlBase
Base MAUI view control for media playback. Wraps MediaPlayer and provides platform-specific rendering through handlers.
public class MediaPlayerControlBase : View, IMediaPlayer, IDisposable
- Inheritance
-
MediaPlayerControlBase
- Implements
Constructors
MediaPlayerControlBase()
Creates a new instance of MediaPlayerControlBase.
public MediaPlayerControlBase()
Fields
BorderColorProperty
Identifies the BorderColor bindable property.
public static readonly BindableProperty BorderColorProperty
Field Value
- BindableProperty
BorderThicknessProperty
Identifies the BorderThickness bindable property.
public static readonly BindableProperty BorderThicknessProperty
Field Value
- BindableProperty
PlayerBackgroundColorProperty
Identifies the PlayerBackgroundColor bindable property.
public static readonly BindableProperty PlayerBackgroundColorProperty
Field Value
- BindableProperty
StatBackColorProperty
Identifies the StatBackColor bindable property.
public static readonly BindableProperty StatBackColorProperty
Field Value
- BindableProperty
StatColorProperty
Identifies the StatColor bindable property.
public static readonly BindableProperty StatColorProperty
Field Value
- BindableProperty
StatFontProperty
Identifies the StatFont bindable property.
public static readonly BindableProperty StatFontProperty
Field Value
- BindableProperty
StatHeightRequestProperty
Identifies the StatHeightRequest bindable property.
public static readonly BindableProperty StatHeightRequestProperty
Field Value
- BindableProperty
StatIsVisibleProperty
Identifies the StatIsVisible bindable property.
public static readonly BindableProperty StatIsVisibleProperty
Field Value
- BindableProperty
StatMarginProperty
Identifies the StatMargin bindable property.
public static readonly BindableProperty StatMarginProperty
Field Value
- BindableProperty
StatProperty
Identifies the Stat bindable property.
public static readonly BindableProperty StatProperty
Field Value
- BindableProperty
StatWidthRequestProperty
Identifies the StatWidthRequest bindable property.
public static readonly BindableProperty StatWidthRequestProperty
Field Value
- BindableProperty
TitleBackColorProperty
Identifies the TitleBackColor bindable property.
public static readonly BindableProperty TitleBackColorProperty
Field Value
- BindableProperty
TitleColorProperty
Identifies the TitleColor bindable property.
public static readonly BindableProperty TitleColorProperty
Field Value
- BindableProperty
TitleFontProperty
Identifies the TitleFont bindable property.
public static readonly BindableProperty TitleFontProperty
Field Value
- BindableProperty
TitleHeightRequestProperty
Identifies the TitleHeightRequest bindable property.
public static readonly BindableProperty TitleHeightRequestProperty
Field Value
- BindableProperty
TitleIsVisibleProperty
Identifies the TitleIsVisible bindable property.
public static readonly BindableProperty TitleIsVisibleProperty
Field Value
- BindableProperty
TitleMarginProperty
Identifies the TitleMargin bindable property.
public static readonly BindableProperty TitleMarginProperty
Field Value
- BindableProperty
TitleProperty
Identifies the Title bindable property.
public static readonly BindableProperty TitleProperty
Field Value
- BindableProperty
TitleWidthRequestProperty
Identifies the TitleWidthRequest bindable property.
public static readonly BindableProperty TitleWidthRequestProperty
Field Value
- BindableProperty
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 color of the control's border.
public Color BorderColor { get; set; }
Property Value
- Color
BorderThickness
Gets or sets the thickness of the control's border in device-independent units.
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 of the player surface as an ARGB hex string (e.g., "#FF000000").
public string PlayerBackgroundColor { get; set; }
Property Value
Position
Gets or sets the current playback position.
public TimeSpan Position { 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 displayed in the overlay.
public string Stat { get; set; }
Property Value
StatBackColor
Gets or sets the background color of the statistics overlay.
public Color StatBackColor { get; set; }
Property Value
- Color
StatColor
Gets or sets the text color of the statistics overlay.
public Color StatColor { get; set; }
Property Value
- Color
StatFont
Gets or sets the font used for the statistics overlay text.
public Font StatFont { get; set; }
Property Value
- Font
StatHeightRequest
Gets or sets the requested height of the statistics overlay in device-independent units.
public double StatHeightRequest { get; set; }
Property Value
StatIsVisible
Gets or sets whether the statistics overlay is visible.
public bool StatIsVisible { get; set; }
Property Value
StatMargin
Gets or sets the margin around the statistics overlay.
public Thickness StatMargin { get; set; }
Property Value
- Thickness
StatWidthRequest
Gets or sets the requested width of the statistics overlay in device-independent units.
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 displayed in the overlay.
public string Title { get; set; }
Property Value
TitleBackColor
Gets or sets the background color of the title overlay.
public Color TitleBackColor { get; set; }
Property Value
- Color
TitleColor
Gets or sets the text color of the title overlay.
public Color TitleColor { get; set; }
Property Value
- Color
TitleFont
Gets or sets the font used for the title overlay text.
public Font TitleFont { get; set; }
Property Value
- Font
TitleHeightRequest
Gets or sets the requested height of the title overlay in device-independent units.
public double TitleHeightRequest { get; set; }
Property Value
TitleIsVisible
Gets or sets whether the title overlay is visible.
public bool TitleIsVisible { get; set; }
Property Value
TitleMargin
Gets or sets the margin around the title overlay.
public Thickness TitleMargin { get; set; }
Property Value
- Thickness
TitleWidthRequest
Gets or sets the requested width of the title overlay in device-independent units.
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()
Releases all resources used by the media player control. Stops playback, unsubscribes from all events, and clears platform-specific callbacks.
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
Occurs when the player's current state changes (e.g., from Playing to Paused).
public event EventHandler<PlayerState> CurrentStateChanged
Event Type
MediaEnded
Occurs when playback reaches the end of the media.
public event EventHandler MediaEnded
Event Type
MediaFailed
Occurs when a critical or non-critical playback error is encountered.
public event EventHandler<ErrorEventArgs> MediaFailed
Event Type
MediaOpened
Occurs when the media source has been successfully opened and is ready for playback.
public event EventHandler MediaOpened
Event Type
SeekCompleted
Occurs when a seek operation has completed successfully.
public event EventHandler SeekCompleted
Event Type
VideoRenderingStarted
Occurs when video rendering has started and the first frame is about to be displayed.
public event EventHandler VideoRenderingStarted