Issue
I want to check if the prepare() is finished to call start(),Because I sometime when I press the start button it starts playing but I can't pause or stop the player.
Now: I need to wait for a while to make sure that prepare() is finished and it is ready to start and then press start button.
Any suggestions?
Solution
Set OnPreparedListener to the media player instance and inside onPrepared() start the media player.
player.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
player.start();
}
});
developer.android.com/reference/android/media/MediaPlayer.OnPreparedListener
Answered By - Prateek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.