In my application, I am trying to play a sound file in ogg format, stored in raw folder in res directory of my application. When I press the button that calls below function, it just freezes with the button pressed and does not respond. In the end, I have to terminate the application from Eclipse. Nothing about an error or exception in Logcat.
In debugging mode, it enters create function and never comes back. What am I doing wrong?
private void playbeep()
{
mPlayer = MediaPlayer.create(this, R.raw.beep);
mPlayer.start();
mPlayer.release();
}
You start and release the MediaPlayer at the same time. Try taking this out and see if it works.
mPlayer.release();
Also, check my post here to make sure you have the MediaPlayer set up correctly. If all else fails, try your audio file in a different format.