Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doing an audio loop on Android

I have a track I want to play 'megadeth', I'm calling it by:

    final MediaPlayer mp = MediaPlayer.create(this, R.raw.megadeth);

And playing it by using 'mp.start'.

And I just want to know, how can I get this audio mp3 to loop?

like image 239
James Andrew Avatar asked Apr 21 '10 17:04

James Andrew


1 Answers

Before adding

mp.start();

Add

MediaPlayer mp = MediaPlayer.create(MainMenu.this, R.raw.megadeth);
    mp.setLooping(true);

the mp.setLooping(true); automatically allows the raw file to be used over and over again.

like image 152
Tobi Akerele Avatar answered Sep 20 '22 04:09

Tobi Akerele