I’m trying to make an app that plays music and I want to to continue playing when the phone is set to silent or if the phone is put to sleep. (these may need two separate solutions.) The main important thing is to get it to play sounds while the phone is on silent just link music plays on the iPhone. I think the answer may be something to do with Audio Sessions. I found this article, but couldn’t figure out how to make it work. (might be that this technique doesn’t work anymore)
http://forum.unity3d.com/threads/setting-mediaplayback-audio-session-category.206958/
They said to do something like this
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *setCategoryError = nil;
if (![session setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:&setCategoryError]) {
// handle error
}
or
OSStatus propertySetError = 0;
UInt32 allowMixing = true;
propertySetError = AudioSessionSetProperty (
kAudioSessionProperty_OverrideCategoryMixWithOthers, // 1
sizeof (allowMixing), // 2
&allowMixing // 3
);
Though I wasn’t sure where to put this code or what else would need to be done.
Thanks for the help