Using VideoView for streaming or progressive-download video Using VideoView for streaming or progressive-download video android android

Using VideoView for streaming or progressive-download video


is it possible to play video as progressive download, or by streaming, simply by using setVideoPath or setVideoURI, as in VideoViewDemo in the API samples?

It should. It certainly works with MediaPlayer, and VideoView is just a ~200 line wrapper around MediaPlayer and a SurfaceView.

The VideoViewDemo code suggests using setVideoURI for streaming, but I'm not clear what kind of URL I should be using.

http:// and rtsp:// can work, if the video was encoded properly.

Does someone have an example URL for a video that can be streamed to the Android emulator using the VideoViewDemo code?

This video works with MediaPlayer, except on the Nexus One.

EDIT: Actually, that link works with the Nexus One as well.


It works for simple cases, but only when it is not required to make some custom preparations for requests to get a stream.

This tutorial shows an example of manual streaming emulation for an audio but it can be a little refactored to play video:

http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/

(be sure to use FileDescriptor when setting dataSource, the API was changed slightly from those times).


VideoView can only Stream 3gp videos but i recommend this code to stream your video

public void onCreate(Bundle savedInstanceState){setContentView(R.layout.main);String videourl = "http://something.com/blah.mp4";Uri uri = Uri.parse(videourl);Intent intent = new Intent(Intent.ACTION_VIEW, uri);intent.setDataAndType(uri, "video/mp4");startActivity(intent);}

Or Click here to watch Android Video Streaming Tutorial.