I checked Google and here as well. Maybe the question hasn't been asked yet or I am just asking it in a very weird way. There are certain apps, one that I've noticed in particular is Snapchat, where when the app opens, the music continues to play even with the camera and even while taking a picture with silent switch turn on or off. The camera sound goes off as well.
So for an example, right now I am listening to music through Soundcloud and when I open my app, the music stops playing, but I can press play and continue to play music while using my app once I put this line of code in my appWillEnterForeground
method: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
When I do this in Snapchat, the music continues to play. Even when I take a video too!
How?