Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How do I play a local video file using VideoView?

HiggyHiggy GBMember


I have followed the Xamarin documentation and can play a video using the VideoView if it has an URL, However, there is no documentation for playing local files and I would like to play a video that has been copied into my Assets or Resource folder. Here is the code for the videoView URL.

        VideoView videoView = FindViewById<VideoView> (;

        var uri = Android.Net.Uri.Parse ("http:// path here all works good");
        videoView.SetVideoURI (uri);
        videoView.RequestFocus ();
        videoView.Start ();

I have tried changing the Uri to the path of the video, I have also tried :

    videoView.SetVideoPath("/Video/Assets/big_buck_bunny.mp4");     in place of        videoView.SetVideoURI (uri);

None of these methods seem to work, Am I missing something out of the path string? or perhaps not saving the video to the correct folder? Upon running the emulator and any android device just a warning message is displayed saying "cannot play this video". Any help would be greatly appreciated.

Thank you


  • HiggyHiggy GBMember

    Yes, thank you very much sir, only thing that needs noting is that you cannot seem to use :

    videoView.SetMediaController(new MediaController(this));

    This enables functions to pause, previous and next when using the URL code, does not seem to work when using the code provided by RendyDelRosario, However, I suppose it is not to difficult to assign personal buttons that have a click event that run the pause(), stop() etc methods. Thank you again for a quick reply and providing a solution.

  • HiggyHiggy GBMember

    Another quick note is that for this code to work, the video file is needed to be stored in the assets folder of the project, rather than resources.raw or any other folder. Aside from that it works perfectly thanks again.

  • VineethSVineethS USMember

    The above code works fine on giving videoView.Start() the video will start playing but,
    how to select the video and just display it in videoView without playing ?

  • veeru3112veeru3112 INMember ✭✭
            string videoPath = string.Format("android.resource://{0}/{1}", "sampledemo.droid", Resource.Raw.video2);
  • srikanthbadisasrikanthbadisa INMember ✭✭

    How do I play a youtube videos
    using VideoView?

Sign In or Register to comment.