I have an application in which I am currently setting the AVAudioSession category once when initializing a singleton class (maybe not in the best place):
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
The app is registered for background sound and it works great. But sometimes after the application goes into the background and returns to the foreground and returns to the background, the sound stops abruptly.
I don’t understand how often and what method should be installed in the audio session, and I can’t find the sentence in the documents. Should it be in application:didFinishLaunchingWithOptions:
or every time the application becomes active in applicationDidBecomeActive:
or somewhere else? Why does it cost reset to handleMediaServicesReset
.
source
share