Using Videoview for Streaming or Progressive-Download Video

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.

Streaming video with videoview

try this code,it work,

public class PlayVideo extends Activity
{

private String videoPath ="url";

private static ProgressDialog progressDialog;
String videourl;
VideoView videoView ;

protected void onCreate(Bundle savedInstanceState)
{

super.onCreate(savedInstanceState);
setContentView(R.layout.play_video);

videoView = (VideoView) findViewById(R.id.videoView);

progressDialog = ProgressDialog.show(PlayVideo.this, "", "Buffering video...", true);
progressDialog.setCancelable(true);

PlayVideo();

}
private void PlayVideo()
{
try
{
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mediaController = new MediaController(PlayVideo.this);
mediaController.setAnchorView(videoView);

Uri video = Uri.parse(videoPath );
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.requestFocus();
videoView.setOnPreparedListener(new OnPreparedListener()
{

public void onPrepared(MediaPlayer mp)
{
progressDialog.dismiss();
videoView.start();
}
});

}
catch(Exception e)
{
progressDialog.dismiss();
System.out.println("Video Play Error :"+e.toString());
finish();
}

}
}

How can I save video played in VideoView using Http streaming

You have no access to the stream data being pulled in by VideoView (or the underlying MediaPlayer).

How to stream and download a media from local storage using Android's VideoView?

Finally I found out my problem the problem wasn't with the code but the media I have used wasn't standard according to google's doc.

You can read more here : http://www.vahidhashemi.com/?p=120



Related Topics



Leave a reply



Submit