如何播放 AMR 音频文件?

How to play an AMR audio file?

我正在尝试播放 .amr 文件。

func prepareAudio() {
    do {
        self.audioPlayer =  try AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("welcome", ofType: "amr")!))
        self.audioPlayer.play()           
    } catch {
        print("Error")
    }
}

outPut

ERROR:    >aq> 327: AudioConverterNew from AudioQueueNew returned 'fmt?'
io:     1 ch,   8000 Hz, Float32
client:    1 ch,   8000 Hz, 'samr' (0x00000000) 0 bits/channel, 0 bytes/packet, 2400 frames/packet, 0 bytes/frame

A​​MR 编解码器已从 3.2 版 iOS 中删除(我认为)。啊不,4.3(谢谢 Eric D.)。我发现的唯一参考是 dev forums(需要登录)。

奇怪的是,虽然 kAudioFormatAMR 在 iOS 4.3 中被删除,但看起来 kAudioFormatAMR_WBadded to OSX 10.10 (Yosemite)