如何播放AMR音频文件? [英] How to play an AMR audio file?

查看:169
本文介绍了如何播放AMR音频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

输出

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

解决方案

AMR编解码器已从3.2版的iOS中删除(我认为).啊,不是4.3(谢谢Eric D.).我唯一找到的参考文献是在开发论坛(需要登录)./p>

奇怪的是,在iOS 4.3中删除了kAudioFormatAMR时,看起来kAudioFormatAMR_WB

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

The AMR codec was removed from iOS in version 3.2 (I think). Ah no, 4.3 (thanks, Eric D.). The only reference I ever found to this was in the dev forums (login required).

The strange thing is, while kAudioFormatAMR was removed in iOS 4.3, it looks like kAudioFormatAMR_WB was added to OSX 10.10 (Yosemite).

这篇关于如何播放AMR音频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆