Reputation: 568
I am wishing to seamlessly loop mp3's for an app written in MonoTouch using the AVAudioPlayer and cannot find any examples on how to achieve this. I have found a great library at http://gamua.com/blog/2012/05/gapless-mp3-audio-on-ios/ however it is written for objective c.
I wish for the audio to continue to play even when the device is locked and have played around with the AudioSession initilizer but failed to have this working also.
I am not able to find examples or libraries to assist in achieving results.
Upvotes: 2
Views: 358
Reputation: 26495
For queuing up songs without any spaces in between, make sure to use AVQueuePlayer
, it allows you to pre-load songs. If you just want to loop the same song, just set NumberOfLoops
to 0 on AVAudioPlayer
and it will loop forever.
For playing audio in the background, you also need to declare UIBackgroundModes
in your Info.plist
. See this guy's article here. He's using Obj-C, but you should be able to port his code to MonoTouch.
Upvotes: 2