I've been working on a Processing Sketch in Android Mode. I had problems with Minim
library so, I decided to use MediaPlayer
.
What I want to do is very simple, to play an mp3
file.
Code:
import android.media.MediaPlayer;
import android.media.AudioManager;
import android.net.Uri;
MediaPlayer p;
void setup()
{
//Uri needed for the create Method
Uri u = Uri.parse("m.mp3");//The file is in the data folder
p = MediaPlayer.create(this, u);
p.start();
}
I know that in Android you make an Uri like "R.raw.m"
...
Now, the app doesn't work when I run it and I think is due to the Uri
. I just don't know how to make it work. Thanks a lot.