I am useing AVPlayer to play setof songs from urls. I can play songs in background mode too. But the problem is in background mode the next song is not playing. It excecute the code and but [player play]; method is not working. But If play 1 song it plays to the end though it goes to the background mode.
Please help me
Thanks
You should use AVQueuePlayer
instead. This is working fine for me.
Well, you probably have this figured out by now, but for anyone else who might come across this, try putting this in your viewDidLoad:
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
Assuming you have this :
NSError *setCategoryErr = nil;
NSError *activationErr = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:&setCategoryErr];
[[AVAudioSession sharedInstance] setActive:YES error:&activationErr];
in your AppDelegate.m, under didFinishLaunch and your info.plist set up to play audio in the background.
Had the same problem, and this solved it for me.