I am developing a project that play music in the background. Basically, the app will continue play the audio file even the screen is locked.
I have setup the background mode by selecting audio option, as you can see in this photo:
It works fine as I expected that the app keep playing the audio when users lock the screen. However, when a call is received, the app stop playing. I thought it may start playing again after the phone call finished. However, it didn't.
I check a few webs, should I do some modification in the AppDelegate file, such as this method:
func applicationWillResignActive(_ application: UIApplication)
Basically, what I am trying to figure out is, how can I pause the audio when phone call or other notifications come and resume playing the audio when the phone call or other notifications finished.
Thanks in advance.