Saturday March 30th, 2019

Xamarin.Forms Video Player

By Ebubekir Sezer

Hello, When we are making projects sometimes we may need to put video player to your application or maybe you develop a projects for the playing video applications. In some projects which i developed with Xamarin.Forms, i need to put an video player and for the putting an video player i made some steps. After these steps i can easily play videos on my projects.

For the making an video player with Xamarin.Forms we need to install a plugin. After the creating my project i added the plugin which name is Plugin.MediaManager.Forms. There are some features inside of this plugin, we may want to use in our projects. Also thanks to this plugin we can play audio in our projects if we want. After the adding plugin to our project, we should go MainActivity in Android and AppDelegate in IOS to add some codes for the initialize plugin.


After the adding this code we should make a design inside the Xaml. I making a really simple design. You can find the better design in my github.

 <myplayer:VideoView WidthRequest="250"

We made the design, now we should add the events in C#. In C# part we can do whatever we want to do with this video player but for this article i am just making really simple code sharing. You can find the better usage in my github account.

await CrossMediaManager.Current.Play("", MediaFileType.Video);

After the all of these parts, we can easily play video or audio in our projects. Also you can reach the project which i develop for the video player with clicking here in my github. There is a screen record from my project in below. You can share your questions or thoughts via comments or e-mail.