Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to play video stored on a online file server?

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?

like image 954
Vipul Purohit Avatar asked Feb 22 '23 09:02

Vipul Purohit


2 Answers

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)

like image 141
Aleks G Avatar answered Mar 03 '23 17:03

Aleks G


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>
like image 39
Seshu Vinay Avatar answered Mar 03 '23 16:03

Seshu Vinay