I\'m trying to play multiple sounds at the same time.
The approach initially I\'ve taken was to create several players , but it seems wrong one.
What\'s the
Basically what everyone else is saying, make sure you create an audio player for each source.
What you also must do is KEEP A STRONG REFERENCE TO ALL THE PLAYER OBJECTS.
If you don't do this they get released and playback stops.
I had this issue when I was only keeping a reference to the last source I wanted to play back. This meant that I would only hear the last data source and I thought the issue was something to do with the simultaneous playback configuration - but in reality it was just the other players were being dealloc'd and thus playback would stop.
try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, options: .mixWithOthers)
try? AVAudioSession.sharedInstance().setActive(true)
I also used the above snippet before creating and playing back my audio sources.