Kishore Kumar
Kishore Kumar

Reputation: 4375

How to play an AMR audio file?

I am trying to play an .amr file.

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

Upvotes: 5

Views: 1340

Answers (1)

Gordon Childs
Gordon Childs

Reputation: 36072

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).

Upvotes: 1

Related Questions