How to play video stored on a online file server?

Vipul Purohit picture Vipul Purohit · Feb 21, 2012 · Viewed 6.9k times · Source

I have to play a video in my android app. The file is stored on a online file server

link is : http://view.vzaar.com/923037/video

I am unable to play this file using VideoView. I also tried to load this file into WebView but the WebView opens Web Browser and then the file starts playing.

Is there any way to play these kind of file directly into my app without downloading into device?

Answer

Aleks G picture Aleks G · Feb 21, 2012

For your VideoView, the prpoblem is with setVideoPath method. You need to use setVideoURI instead to specify a streaming source:

VideoView mVideoView = (VideoView) findViewById(R.id.vdoTest);
mVideoView.setMediaController(new MediaController(this));
String viewSource ="http://view.vzaar.com/923037/video";
mVideoView.setVideoURI(Uri.parse(viewSource));

This should work, provided the video is encoded correctly: (AAC+H.264, baseline)