.oga快速播放

时间:2019-02-24 16:04:13

标签: ios swift

我正在尝试使用带有以下代码的AVAudioPlayer播放音频文件:

let urlString = "http://192.168.1.19:8080/download/2"
let url = URL(string: urlString)!
print("the url = \(url)")

do {
    let data = try Data.init(contentsOf: url)
    self.audioPlayer = try AVAudioPlayer.init(data: data)
    self.audioPlayer.prepareToPlay()

    self.audioPlayer.play()
} catch {
    print("couldn't load file")
}

音频格式为Oga(.oga),并且始终无法加载。播放此.oga文件有什么解决方法?

0 个答案:

没有答案