I\'m using the following code to play a sound off a URL from the internet:
var audioPlayer = AVPlayer()
...
let audioSessio
swift 2+ solution:
do { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) try AVAudioSession.sharedInstance().setActive(true) } catch _ { return print("error") }