How to play AMR audio file?

I am trying to play a .amr file.

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

audio 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 
+5
source share
1 answer

The AMR codec was removed from iOS in version 3.2 (I think). Oh no, 4.3 (thanks, Eric D.). The only link I've ever met was in dev forums (login required).

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

+1
source

Source: https://habr.com/ru/post/1238754/


All Articles