Microsoft recently released another control for the .NET MAUI platform: MediaElement. This is one of the components of the .NET MAUI Community Toolkit that enables audio and video playback within .NET MAUI applications.

Users already know MediaElement from the Xamarin Community Toolkit, where it was added thanks to the amazing work of community member Peter Foote. While this version was good enough, it also had room for improvement, especially on Android.

That’s why when porting MediaElement to .NET MAUI, the eeup of developers built everything from scratch. This way they made sure they kept all the parts that were already good.

Under the hood
For Android, ExoPlayer was used as the platform analog, replacing Android MediaPlayer which was used for Xamarin. This automatically gets a lot of extra features that are available out of the box, such as HTTP Live Streaming (HLS) video playback, look and feel controls for platform transport, and many other things.

On iOS and macOS, the AVPlayer platform is used, as was done with Xamarin’s MediaElement. Also the one for Tizen is unchanged, using Tizen.Multimedia.Player.

Getting Started
Getting started with MediaElement is easy. First you need to install the CommunityToolkit.Maui.MediaElement NuGet package. This is a separate package from the main Community Toolkit package.

All current MediaElement features are available on the documentation page. Vesluis has also posted a video describing the basics of how to get started with MediaElement.

Tags: , , , , , , , , , , , , , , ,
Editor @ DevStyleR