Vishnu Mohan G
Vishnu Mohan G

Reputation: 622

android: append audio

I have multiple files that I play in my android code using mediaplayer.I want them to play one after another.

Is there a way to append audio that i play using MediaPlayer(or similar)? or Is there a way to execute a code at end of playing a media file?

Thanks in advance.

Upvotes: 3

Views: 177

Answers (1)

Hesham Saeed
Hesham Saeed

Reputation: 5378

You have to use MediaPlayer.OnCompletionListener():

mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
    public void onCompletion(MediaPlayer mp) {
        //you can play the another audio file here
    }
});

Upvotes: 2

Related Questions