4

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?

2
  • Provided this is an MP4 file (which it seems like it is), you should be able to play it in VideoView. Show us your code, maybe we'll spot the problem then.
    – Aleks G
    Feb 21, 2012 at 13:05
  • VideoView mVideoView = (VideoView) findViewById(R.id.vdoTest); mVideoView.setVideoPath("view.vzaar.com/923037/video"); mVideoView.setMediaController(new MediaController(this)); This is my code for VideoView Feb 21, 2012 at 13:32

2 Answers 2

7

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)

1
  • Thanks a lot Aleks. You solved my problem. Work like a charm. Just one more question, Can I show thumbnail of video? Thnx in advance Feb 22, 2012 at 4:51
1

write this html code and load it in webview:

<html><body><embed src="http://view.vzaar.com/923037/video" width="100%" height="100%"></embed></body></html>
1
  • Sorry sir I have tried your method but it dosent work. Only a blank page show. but thnx for your help. Feb 22, 2012 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.