Forum Xamarin.Forms

Xamarin Forms Video Player

AdamFisherAdamFisher USMember ✭✭

When I was taking classes last year through Xamarin University, I was surprised to find there was no Xamarin Forms video player component in core. So I thought it would be a fun little side project I have been working on for the past few months. I just released it to the Xamarin Component Store. It allows you to hook into events (playing, paused, completed, etc.) and comes with a variety of options for volume, visibility, and arbitrary events for time intervals among other things - all from shared code.

Let me know what you guys think. I hope you find it useful in your projects. I am opening this thread for any discussions related to the component.


Blog Post:

Bug Tracker:


  • AdrianKnightAdrianKnight USMember ✭✭✭✭


    Are you using the default video players in each platform? For Android, can you use ExoPlayer and AVPlayer for iOS? I think a cross-platform video player would be great, but I'd rather purchase one with most recent technology. I especially dislike the stock player on Android since it takes a while to load videos.

  • AdamFisherAdamFisher USMember ✭✭
    edited March 2016

    AVPlayer is used for iOS and VideoView is used for Android. I was thinking about ExoPlayer for Android but decided it was out of scope for the initial release. ExoPlayer is more complex to initialize and manage especially when attempting to map it to a cross-platform interface.

    Someone did create an ExoPlayer binding library and that could be used to extend the VideoPlayerRenderer with an ExoPlayer implementation in the interim.

    Thanks for the suggestion. I added it to the issue queue to keep track of it. I would definitely like to implement it at some point to give more options.

  • AdrianKnightAdrianKnight USMember ✭✭✭✭

    @AdamFisher Would be cool to see more advanced functionality. I have yet to figure out how to detect the following on ExoPlayer: I found ways to do it on iOS, but they seemed quite hacky.

  • AdamFisherAdamFisher USMember ✭✭
    edited April 2016

    ExoPlayer support has been added to the issue queue as a feature request but didn't want to do it for first out since it is only compatible with the newer media framework. The other reason is the unclear alignment between the unified Forms API I am exposing and some of the functionality that ExoPlayer doesn't make readily understandable for mapping it. Long story short, it is on the road map:

    As for your specific situation, you might try overriding the MediaCodecVideoTrackRenderer and creating your own progress changed event listener like they did here:

  • DirkWilhelmDirkWilhelm USMember ✭✭✭✭


    i'm very interested in using your component, but i have a question before i buy it:

    when i tried to implement my own videoplayer, i sometimes get an error message on android like this on some user devices when playing local videos: setDataSourceFD failed.: status=0x80000000 Method) Method)
    java.lang.reflect.Method.invokeNative(Native Method)
    dalvik.system.NativeStart.main(Native Method)
    Xamarin caused by: Java.IO.IOException: setDataSourceFD failed.: status=0x80000000
    Android.Runtime.JNIEnv.CallVoidMethod(IntPtr jobject, IntPtr jmethod, JValue* parms)
    Android.Media.MediaPlayer.SetDataSource(FileDescriptor fd)

    or Prepare failed.: status=0x1 Method) Method)
    java.lang.reflect.Method.invoke(Native Method)
    Xamarin caused by: Java.IO.IOException: Prepare failed.: status=0x1
    Android.Runtime.JNIEnv.CallVoidMethod(IntPtr jobject, IntPtr jmethod)

    Did you ever see this error using your component?

  • AdamFisherAdamFisher USMember ✭✭

    I have not seen that before. It looks like others have experienced this issue on Android and might have something to do with compatibility of the file encoding. Some devices have more advanced support than others for different codecs. You might try re-encoding your file with officially supported Android media formats to see if that is the culprit.

    Another thing to try is hook into the VideoPlayer.Failed event to see if the native video player reported any additional meta data during the error.

  • TupakTupak ARMember

    Hi Adam!

    Very interesting your component!

    I need to play HLS and DASH streaming in iOS, Android and Windows. Can I do this with your Media Player?


  • AdamFisherAdamFisher USMember ✭✭

    The default underlying platforms will dictate the streaming protocols supported. I don't think you would get those capabilities on Android by default but you could always use the component and create a native renderer and incorporate ExoPlayer which I believe would give you what you need.

Sign In or Register to comment.