Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to play .amr files in IOS swift?

I have some audio files which are in amr format, which I cant convert to any other format, Is there any way to play this files in IOS using swift(AVFoundation)?

I tried this code

var audioPlaying = AVAudioPlayer()
audioPlaying = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath:
       NSBundle.mainBundle().pathForResource("music", ofType: "mp3")!), error: nil)
audioPlaying.play()

but when I use the "amr" in ofType:, getting an error which file not exist.

like image 856
Vettiyanakan Avatar asked Mar 24 '15 12:03

Vettiyanakan


People also ask

How Play AMR file in iOS?

The first choice you have is converting the AMR audio files to an audio format that's supported by iOS, like MP3. If you don't want to change the format of the AMR file, you may install a video player that supports the AMR audio format so that you can use it to play your AMR files on iPhone.

How do I listen to an AMR file?

You can open AMR files from your Google Drive and from your computer. It's very easy to use. You can control your playback like Play, Pause, Volume, Playlist and all common controls in any audio player. You don't need to install any further software or plugin to play AMR files.

What program will open a AMR file?

AMR files can be opened by several media players, including Apple QuickTime Player, RealNetworks RealPlayer, and VLC Media Player.

How do I open an AMR 1 file?

Files in AMR format can be opened with Apple QuickTime Player, RealNetworks RealPlayer, MIKSOFT Mobile Media Converter and VideoLAN VLC media player in Mac Os , Microsoft Windows-based systems and Linux systems.


2 Answers

The Opencore-AMR iOS framework is probably your best starting point.

github.com/feuvan/opencore-amr-iOS

Also here's a guide on how to compile it for iOS as it's not an easy task :

http://swati-ios.blogspot.co.uk/2013/01/compile-opencore-amr-for-ios-projects.html

like image 88
GuybrushThreepwood Avatar answered Sep 28 '22 06:09

GuybrushThreepwood


AMR format is no longer supported by Apple (since iOS 4.3).

If you want to Play or Record one, you have to use some tools (like opencore-amr library) to change the format.

like image 22
Bhavin Avatar answered Sep 28 '22 04:09

Bhavin