Hi,
I'm the developer of a Soundboard app. A lot of users have reported me that in their phones some of the sounds cut off early. I have a Nexus One and a HTC Tattoo and everything works fine, I've never noticed the cut off in my phones.
This is my code for the audio part:
First, I have a MediaPlayer object in my main class:
private MediaPlayer mp = null;
And when I puss a button, this is the code:
private OnClickListener onClickSound = new OnClickListener() {
public void onClick(View v) {
if(mp != null){
mp.stop();
mp.release();
mp = null;
}
mp = MediaPlayer.create(getBaseContext(), mp3id));
mp.start();
mp.setOnCompletionListener(completionListener);
}
};
And this is the completionListener:
MediaPlayer.OnCompletionListener completionListener = new MediaPlayer.OnCompletionListener(){
public void onCompletion(MediaPlayer mediaP) {
if(mp != null && !mp.isPlaying()){
mp.stop();
mp.release();
mp = null;
}
}
};
You guys have any clue?
Greetings