I
I
iosDevNapster2016-04-19 11:37:17
Swift
iosDevNapster, 2016-04-19 11:37:17

AVAudioPlayer start audio playback in the background on a timer?

1. Enabled Audio, AirPlay and Picture in Picture in BackgroundModes
2. do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
try AVAudioSession.sharedInstance().setActive(true)
} catch _ {
return print("error")
}
I set the category AVAudioSessionCategoryPlayback
3. I start the player in a timer
The fact is that every 20 seconds a sound is emitted on the open screen (music plays), but when I simply close the application, it does not work. Who faced, who can help solve the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question