As you may see, I'm trying to play audio obtained from a url. Where is the mistake?
The error seems to suggest that the audio from the url is not good...
//let play_url = "https://opus-server.herokuapp.com/asd.wav"
let play_url = "http://www.largesound.com/ashborytour/sound/brobob.mp3"
var audioPlayer: AVAudioPlayer?
@IBAction func play(_ sender: Any) {
let url = URL(string: play_url)!
do {
audioPlayer = try AVAudioPlayer(contentsOf: url)
audioPlayer?.play()
} catch {
print(error)
}
}
I expect AVAudioPlayer to play the audio. Instead, there is an error printed: Error Domain=NSOSStatusErrorDomain Code=2003334207 "(null)"