I have yet to find the answer to this question.
I have a local file (R.raw.Bob); and I'm trying to use MediaPlayer to play a file.
Sometimes he plays, sometimes it is not. I have another file that plays seem perfect every time.
My activity stream looks like this: In onCreate, I do the following:
MediaPlayer mBackground = MediaPlayer.create(MainAct.this, R.raw.background);
mBackground.start(); // Works as expected.
Now in another part of the action, I have the following:
MediaPlayer mBob= MediaPlayer.create(MainActivity.this, R.raw.Bob);
mBob.start();
And nothing happens. I used Log.i (), and execution is done through the appropriate code, but the file does not start.
Why does MediaPlayer sometimes work and sometimes not, and is there a more reliable way to play audio files?
source
share