views:

146

answers:

1

I'm and android beginner, so go easy on me ;-)

I'm trying to play a sequence of video files which I'm downloading from a server. The challenge is that I want to have a smooth transition from one file to another.

My thought is to have two MediaPlayer instances each preparing and then playing in turn. It is not clear to me if they can both share the same SurfaceView? Or maybe, I should be using different views and swapping between them? Or, the idea is a bad idea all together?

When I try to run configure the MediaPlayer instance with a view that isn't visible it seems to crash my emulator.

A: 

I followed the API Demo on Video View, and here's how it sets up the VideoView:

mVideoView.setVideoURI(Uri.parse(Uri.encode(URLString)));
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();

I'm not 100% sure, but pretty sure, that the VideoView creates and sets up a MediaPlayer object when you call VideoView.setVideoURI(). It then attaches a MediaController to it with the next call.

You can probably just set up a callback for the OnCompletionListener (more info here in MediaPlayer doc), and have that call VideoView.setVideoURI() for the new file in the playlist.

stormin986
Yes, it is possible to handle the onComplete an pass in a new url.But this results in a delay between the movies, and a blank screen which I'd like to avoid.
DanJ