Sharing VideoView between two MediaPlayers not working

1.1k views Asked by At

I have one main MediaPlayer which plays nicely an RTSP stream and I have used an AsyncTask to buffer the content of another stream. It achieves this. When I try to switch to the second stream, I can hear that the stream switched and it doesn't lag, but I only get sound. The SurfaceHolder holds a VideoView, it has been prepared, I registered it as Display for both mediaplayers. When I switch streams, I stop the old MediaPlayer but the surface doesn't get destroyed, which is good, but it doesn't display my second video. Any ideas?

1

There are 1 answers

4
Matthew On BEST ANSWER

Could you supply your VideoView instantiation code and the code you use to switch out the MediaPlayers?

In any case, I doubt this will work well because the VideoView instantiates its own MediaPlayer and uses it to play media. (see VideoView.java)

You would probably need to switch out the VideoView itself, or build a replacement for the VideoView using your own subclass of SurfaceView.