How to play videos stored on an online file server?

I need to play the video in an android app. The file is stored on a network file server

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

I cannot play this file using VideoView. I also tried loading this file into WebView, but WebView opens a web browser and then starts playing the file.

Is there a way to play this kind of file directly in my application without downloading to the device?

+4
source share
2 answers

For your VideoView, prpoblem has a setVideoPath method. You need to use setVideoURI instead to indicate the 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 if the video is encoded correctly: (AAC + H.264, basic)

+7
source

write this html code and upload it to webview:

 <html><body><embed src="http://view.vzaar.com/923037/video" width="100%" height="100%"></embed></body></html> 
+1
source

Source: https://habr.com/ru/post/1397600/


All Articles