Reputation: 85
I'm trying to make a simple android app that plays and loops through one audio file (like white noise). I'm not sure how audio works with apps, download it to SD card? How do I do this? And how do I loop through it, until "stop" is selected?
Upvotes: 0
Views: 172
Reputation: 12919
If your audio files are static, ship them in your app`s res/raw directory. This is how you can play and loop them from there:
MediaPlayer mp;
mp = MediaPlayer.create(getApplicationContext(), R.raw.yoursound);
mp.setLooping(true);
mp.start();
For stopping, just call
mp.stop();
Upvotes: 1