AVAudioPlayer play Audio without multitasking when device is locked, PLEASE HELP
Hi I really need some help with this issue. Is it possible to play audio when a device is locked in foreground without using mutlitasking flag?
It used to work for me in iOS4 but since iOS5 this no longers functions, it requires me to have multitasking enabled to play audio when the device is locked.
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:audioPath] error:NULL];
audioPlayer.delegate = self;
audioPlayer.pan = speakerBalance / 100;
audioPlayer.numberOfLoops = -1;
audioPlayer.currentTime = 0.0;
audioPlayer.volume = 1.0;
[audioPlayer play];
This code above worked great for me in iOS4 but no longer in iOS5, can someone please tell me if its even possible in iOS5 to have audio play when the device is locked in foreground without the mutlitasking flag enabled.
The reason i don't want the multitasking flag enabled is because this is a free app and the paid version has mulitasking, and if i add the multitasking flag and only have audio play when the device locks Apple reject my app.
I'm really stuck and getting annoyed with Apple's rejections because it seem to me that they removed the ability to use audio when locked without the flag.
The amusing part is the above app is an iPad app, i already have iPhone app that has the mutlitasking flag enabled while not allowing background audio but allowing device locked audio. They are both the same implementation except the Apple review team approved the iPhone but not the iPad version, how lame is that.
I love inconsistent app reviewing...
Thanks
Matt
Last edited by mnifield; 11-21-2011 at 11:51 PM.
|