My code to launch the media player:
MediaPlayer player = MediaPlayer.create(context, Uri.fromFile(new File(context.getExternalCacheDir().getAbsolutePath()+ File.separator + "test.mp3")));
player.setAudioStreamType(playOnStream);
player.start();
player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.release();
}
});
if after that I start any animation (I have different animations with different views start one after another, listening to onAnimationEnd) mediaplayer stops with a logcat message:
05-08 11:17:43.180: W/MediaPlayer-JNI(6571): MediaPlayer finalized without being released
I currently have no ideas on how to work around this
source
share