It worked using
mediaplayer.reset();
mediaplayer.setDataSource();
This simple.
Pregunta
lets say I have 3 mp4 files a.mp4,b.mp4,c.mp4. How can I dynamically click on a button and shift from one file to another in mediaplayer . Mediaplayer will play a.mp4 and onclick of a button it will stop and play b.mp4 . How can I get this functionality. I am using TextureView in place of VideoView.
Thanks
Solución 2
It worked using
mediaplayer.reset();
mediaplayer.setDataSource();
This simple.
Otros consejos
Well you can implement something like this...
changeVidButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
//Get mediaplayer object while setting the video
mediaplayerObject.release();
//Set next video
if(video2) //video2 and video3 are booleans to control path
mediaplayerObject.setDataSource(/*ur next video path*/);
else if(video3)
mediaplayerObject.setDataSource(/*ur next video path*/);
....
....
}
});
You can change this logic as per your need.
Hope this helps. Cheers.:)