Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using VideoView for streaming or progressive-download video

I'm confused about how VideoView can be used to play video: from a local file, as progressive download and streaming.

This example work for me (on 1.5 and 2.0 at least) by downloading the file and playing it locally.

But is it necessary to download the video before playing: 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?

The VideoViewDemo code suggests using setVideoURI for streaming, but I'm not clear what kind of URL I should be using. Does someone have an example URL for a video that can be streamed to the Android emulator using the VideoViewDemo code?

Can progressive download be used with VideoViewDemo? I get a 'sorry, this video cannot be played' message using setVideoPath with URLs that work fine with the blog example linked to above.(Is this a problem in the emulator? I've tried 1.5 and 2.0.)

I've found a lot of examples and documentation online but, so far, nothing that really answers this question.

like image 310
Sam Dutton Avatar asked Jan 13 '10 17:01

Sam Dutton


People also ask

What is the difference between streaming and progressive downloading?

Technically, both streaming and progressive downloading are methods to deliver online video. Streaming is the delivery of video by means of a dedicated video streaming server to a client video channel. Progressive download is simply the delivery of video files over standard web servers (HTTP).

Is YouTube streaming or progressive download?

A huge number of websites favor progressive downloads, including YouTube. These sites use free, open source Web server software, rather than proprietary streaming servers, such as Windows Media Services and Flash Media Server.

What is the difference between downloading and streaming?

What's the difference between streaming and downloading programmes? When you watch a programme online, either live or on demand, this is known as streaming. Downloading is saving the programme to your device temporarily and watching it when you're not connected to the internet.

What is progressive download video?

Progressive download is a technique used to stream media from a web server to a client such as a video player on a laptop or mobile phone. Without progressive download, a client has to download the entire media file before video playback can start.


2 Answers

It works for simple cases, but only when it is not required to make some custom preparations for requests to get a stream.

This tutorial shows an example of manual streaming emulation for an audio but it can be a little refactored to play video:

http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/

(be sure to use FileDescriptor when setting dataSource, the API was changed slightly from those times).

like image 20
shaman.sir Avatar answered Oct 13 '22 00:10

shaman.sir


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.

like image 111
CommonsWare Avatar answered Oct 13 '22 01:10

CommonsWare