Forum Xamarin.Forms

Play a content with DRM in ExoPlayer and AVPlayer

EnricoRossiniEnricoRossini USMember ✭✭✭✭

Hi guys,
I'm looking around for finding a way to play a video with DRM (or ProtectionInfo) with the native players, ExoPlayer for Android or AVPlayer for iOS.

Is there any examples for that? Is it possible to use Xamarin.Forms or I have to use nativa applications?
Thank you in advance.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can achieve it with custom renderer in different platforms, I am not familar with IOS, but I can give your some advice in android.

    You can create a custom view, inherit the View like following code.

      public class VideoPlayer : View
    {
        public static readonly BindableProperty SourceUrlProperty = 
        BindableProperty.Create("SourceUrl", typeof(string), typeof(VideoPlayer));
    
      public string SourceUrl
      {
        get => (string)GetValue(SourceUrlProperty);
        set => SetValue(SourceUrlProperty, value);
      }
     }
    

    Then in the android platform, you can use this nuget packages to achieve that.
    Xam.Plugins.Android.ExoPlayer

    You can refer to know more details in this link
    https://www.pshul.com/2018/02/09/xamarin-forms-android-using-exoplayer-in-your-app/

    Here is demo link.
    https://github.com/AlexPshul/ExoPlayerDemo

  • EnricoRossiniEnricoRossini USMember ✭✭✭✭
    edited September 2019

    Thank you @LeonLu I saw this post and created a VideoPlayer. The problem is on DRM. I can't find a way to add DRM (or ProtectionInfo) to the player.

    For example, Azure Media Player site gives you an idea what I'm looking for. I have an url for the manifest and then I have to add a protection.

    Also, from Azure Media Player I have a manifest for the content not a file such as .mp4

Sign In or Register to comment.