I'm working on an App that streams audio from firebase, which is functioning properly for play but else block for pause not working and I tried debugging it with breakpoints which debugged with the message no executable code found at line....
public void playSong(List<MemberAudio> arrayListAudio, int adapterPosition) throws IOException {
MemberAudio memberAudio = arrayListAudio.get(adapterPosition);
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.release();
mediaPlayer = null;
}
mediaPlayer = new MediaPlayer();
mediaPlayer.setDataSource(memberAudio.getAudioUri());
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
if (!mp.isPlaying()) {
mp.start();
Toast.makeText(ShowAudio.this, "play", Toast.LENGTH_SHORT).show();
} else if (mp.isPlaying()) {
mp.pause();
Toast.makeText(ShowAudio.this, "pause", Toast.LENGTH_SHORT).show();
}//at this line code is not executable
}
});//at this line code is not executable
mediaPlayer.prepareAsync();
}
Aucun commentaire:
Enregistrer un commentaire