AVAudioPlayer NSOSStatusErrorDomain错误

时间:2019-04-16 19:03:23

标签: swift avaudioplayer

您可能会看到,我正在尝试播放从URL获得的音频。错误在哪里?

该错误似乎表明来自网址的音频效果不佳...

//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)
    }

}

我希望AVAudioPlayer播放音频。而是打印了一个错误:Error Domain = NSOSStatusErrorDomain Code = 2003334207“(null)”

0 个答案:

没有答案