Find file History

README.md

id title brief sdk
4A25B2A3-4CEF-0668-9974-24D17DC88550
Play Video
This recipe shows how to play a video using the VideoView class.

Recipe

Follow these steps to play a video.

  1. Add a VideoView to an Xml layout.
<VideoView android:id="@+id/SampleVideoView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
</VideoView>
  1. Obtain a reference to the VideoView in code.
var videoView = FindViewById<VideoView> (Resource.Id.SampleVideoView);
  1. Create an Android.Net.Uri for the video.
var uri = Android.Net.Uri.Parse ("video url goes here");
  1. Pass this Uri to the VideoView.
videoView.SetVideoURI (uri);
  1. Start the VideoView.
videoView.Start ();
  1. Under **Project Options**, add an Android Manifest. Under Required permissions set the INTERNET permission and press **OK**.

Additional Information

The VideoView is a convenience class that encapsulates a MediaPlayer and SurfaceView internally.