Xamarin.Forms Video Player
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.
VideoViewRenderer.Init();
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" HeightRequest="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("https://sec.ch9.ms/ch9/4c34/35791e22-062a-47df-a165-6d3849e54c34/ApplicationResources.mp4", 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.
Merhaba, yazı için çok teşekkürler. Bazı videolar oynatılmıyor. Günlerdir araştırıyorum kullanmadığım 3.parti eklenti kalmadı. Bu konuyla ilgili muhakkak bir sorun yaşamışsınızdir. Rica etsem fikir verebilir misiniz. Teşekkürler şimdiden.
Teşekkürler
Merhabalar, evet bazı youtube url’leri ve bazı url’lerden video oynatılamıyor, bunu video url’ini web view içerisinde açarsan istediğini elde edebilirsin belki. Yine sorun yaşarsan projeni Github üzerinden benimle paylaşırsan yardımcı olabilirim.