0
votes

I have some video file embedded with the project, that to be opened in the native video player using Xamarin forms.

Note: Having in-app video player is limited here.

Any idea for this?

1
This article does'nt tells about playing a local content.Sankarann
Did you check 5 articles on that link?Shiwanka Chathuranga
Where is video file ? PCL or Xamarin.Android Assets folder?Eren Shen
@YorkShen-MSFT Its inside Raw folder of Xamarin.AndroidSankarann

1 Answers

0
votes

Sorry for late, you could refer to FormsNativeVideoPlayer. When you load your video file from Raw folder, you just need to modify the VideoPlayer_CustomRenderer code like this :

protected override void OnElementChanged (ElementChangedEventArgs<Xamarin.Forms.View> e)
{
    base.OnElementChanged (e);

    ...

    string uriPath = "android.resource://" + Forms.Context.PackageName + "/" + Resource.Raw.audio;
    var uri = Android.Net.Uri.Parse((uriPath));

    //Set the videoView with our uri, this could also be a local video on device
    videoView.SetVideoURI (uri);

    ...
 }