The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier
MediaElement is a view for playing video and audio. Media that's supported by the underlying platform can be played from the following sources:
The web, using a URI (HTTP or HTTPS).
A resource embedded in the platform application, using the ms-appx:/// URI scheme.
Files that come from the app's local and temporary data folders, using the ms-appdata:/// URI scheme.
The device's library.
Detailed Design
MediaElement.shared.cs
public class MediaElement : View, IMediaElementController
{
public static readonly BindableProperty AspectProperty;
public static readonly BindableProperty AutoPlayProperty;
public static readonly BindableProperty BufferingProgressProperty;
public static readonly BindableProperty CurrentStateProperty;
public static readonly BindableProperty DurationProperty;
public static readonly BindableProperty IsLoopingProperty;
public static readonly BindableProperty KeepScreenOnProperty;
public static readonly BindableProperty PositionProperty;
public static readonly BindableProperty ShowsPlaybackControlsProperty;
public static readonly BindableProperty SourceProperty;
public static readonly BindableProperty VideoHeightProperty;
public static readonly BindableProperty VideoWidthProperty;
public static readonly BindableProperty VolumeProperty;
public static readonly BindableProperty SpeedProperty;
public double BufferingProgress { get; }
public bool CanSeek { get; }
public MediaElementState CurrentState { get; }
public TimeSpan? Duration { get; }
public int VideoHeight { get; }
public int VideoWidth { get;}
public Aspect Aspect { get; set; }
public bool AutoPlay { get; set; }
public bool IsLooping { get; set; }
public bool KeepScreenOn { get; set; }
public bool ShowsPlaybackControls { get; set; }
public TimeSpan Position { get; set; }
[Forms.TypeConverter(typeof(MediaSourceConverter))]
public MediaSource? Source { get; set; }
public double Volume { get; set; }
public double Speed { get; set; }
public event EventHandler? MediaEnded;
public event EventHandler? MediaFailed;
public event EventHandler? MediaOpened;
public event EventHandler? SeekCompleted;
public void Play() ;
public void Pause();
public void Stop();
}
MediaElement
Summary
MediaElement is a view for playing video and audio. Media that's supported by the underlying platform can be played from the following sources:
Detailed Design
MediaElement.shared.cs
Usage Syntax