How to loop an audio file

The only mention of looping audio I can find is in some OpenAL threads. My app needs to run on iOS and Android, and as far as I can tell OpenAL doesn’t work on Android, unless you use .wav files, which is out of the question considering that I want to loop long ambient sounds (for file size concerns I need to use low sample rate mp3 files).

So what is the most up to date, cross-platform method of looping a sound?

I can play sounds like this:

local soundID = media.newEventSound( pathToSoundFile );  
media.playEventSound( soundID );  

but I don’t see any way to loop music. [import]uid: 52127 topic_id: 12373 reply_id: 312373[/import]

I think I saw there was a problem with the media stuff and you should use audio instead. Here’s a sample of what I’m using to loop my music:

local intromusic = audio.loadStream( "intromusic.mp3" , true)  
 local playThatFunkyMusic = function()  
 audio.play( intromusic, { channel=12, loops=-1 } )  
 end  
 local playIntroMusic = timer.performWithDelay(1, playThatFunkyMusic, 1)  

[import]uid: 14032 topic_id: 12373 reply_id: 45111[/import]

Have you tested that code on Android devices? [import]uid: 52127 topic_id: 12373 reply_id: 45114[/import]

Yep. No problems on iOS or Android. [import]uid: 14032 topic_id: 12373 reply_id: 45115[/import]