Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

android - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...