1 rating
  • 1
  • 2
  • 3
  • 4
  • 5
5 star 1
4 star 0
3 star 0
2 star 0
1 star 0
Compatible with
  • Android
  • iOS

XM.MediaPlayer 1.0.0

xamarians

Cross Platform Library to play videos in Xamarin.Forms. Supports android and iOS platform.

MediaPlayer

Cross Platform Media Player to play videos in Xamarin.Forms. Supports android and iOS platforms.

First add component from xamarin component.

You can integrate video player in you Xamarin Form application using following code:

Shared Code -

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xamarians="clr-namespace:Xamarians.MediaPlayer;assembly=Xamarians.MediaPlayer"
             x:Class="App1.MainPage">

    <xamarians:VideoPlayer Source="<VIDEO URL>" AutoPlay="True">

    </xamarians:VideoPlayer>

</ContentPage>

To play video in full screen ,you need to add these lines in MainPage -

       videoPlayer.FullScreenStatusChanged += VideoPlayer_FullScreenStatusChanged;

        private void VideoPlayer_FullScreenStatusChanged(object sender, bool value)
        {
            NavigationPage.SetHasNavigationBar(this, !value);
        }

Android - in MainActivity file write below code -

Xamarians.MediaPlayer.Droid.VideoPlayerRenderer.Init(this);

iOS - in AppDelegate file write below code -

Xamarians.MediaPlayer.iOS.VideoPlayerRenderer.Init();

Also add following lines in info.plist to allow app to open url over http.

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Be the first to write a review