I'm having some weird issues playing sounds using Android MediaPlayer.
In my view constructor, I do this:
clickSound = MediaPlayer.create(context, R.raw.ggclick);
rightSound = MediaPlayer.create(context, R.raw.right);
wrongSound = MediaPlayer.create(context, R.raw.wrong);
and then when I want to play the sound:
if(prefs.getBoolean("playClick", true))
clickSound.start();
Files are very short WAV files, and it worked. I recently upgraded my phone to version 2.2 (FRG83G), and I think when clickSound stopped working. The other two are still working.
I tried switching the click sound to ogg and then all three worked. Just for consistency, I switched the other two to ogg, and again the click sound stopped working, but the other two played successfully.
Does anyone know what is going on here?
source
share