View Video with VideoView : Video « Media « Android






View Video with VideoView

  
package app.test;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class Test extends Activity {
  VideoView vv;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    vv = (VideoView) this.findViewById(R.id.VideoView);
    Uri videoUri = Uri
        .parse("rtsp://youtube.com/video.3gp");
    vv.setMediaController(new MediaController(this));
    vv.setVideoURI(videoUri);
    vv.start();
  }
}


//main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<VideoView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/VideoView"></VideoView>
</LinearLayout>

   
    
  








Related examples in the same category

1.Record video
2.Capture Video
3.Store image and video
4.Load video file from local file system
5.Uri for local video file
6.Custom Video Player
7.Get Video size
8.Display video with VideoView
9.Using MediaController to control Video
10.Play video from Youtube.com
11.Video Gallery
12.Video Capture
13.Video Capture with Metadata
14.VideoView Demo