Reputation: 40107
I am designing an app that can record short audio files on iPhone and Android that can be played back on both platforms, as well as hopefully any other smartphone.
Right now I'm using *.caf with the iLBC codec, as I know the iPhone does not encode mp3.
Is there a file format/codec that I should use in this case?
Upvotes: 12
Views: 12719
Reputation: 89
Try modifying the file type in your ios version file to be .wav
and you should be able to listen to this audio file on an Android phone, as well as a Windows operating system.
Upvotes: 1
Reputation: 7510
As explained above by typo.pl, the generally compatible format is AMR or WAVE(PCM), but in practice, we prefer a progressive solution:
produce AAC on iOS and Android 2.3.3+, but fallback to produce AMR (WB) on Android pre-2.3.3. Both formats are playable on all platforms.
I guess it's a fairly easy solution for better compatibility and audio quality.
Upvotes: 0
Reputation: 8942
It used to be that there were no common audio encoding formats for Android and iPhone.
iPhone: iPhone audio encoding supported formats
Android: Android supported media formats
But Android 2.3.3 adds support for AMR-WB and AAC: Android Audio Encoder AAC
See Media Framework at Android 2.3.3 API changes
So I believe AAC is your format choice if you want interop between Android and iPhone devices and can handle the Android 2.3.3 limitation.
Otherwise, just pick from the list for widest coverage (AMR-NB on Android) or plan on converting the recorded audio to a suitable format.
A quick check shows that AMR is patented and I assume AAC would have some patent coverage as well. PCM is decodable on iPhone and Android and most cellphones at the expense of larger filesize.
Upvotes: 14
Reputation: 4396
You'll find that mp3 has hardware decoding in all recent iOS devices and most Android mobile phones as well (but not cheap tablets, budget phones, etc).
Upvotes: 0
Reputation: 75296
All smartphones can play WAV files (even Android as of 2.2). These are known as "Linear PCM" in iOS and "PCM/WAVE" in Android.
Upvotes: 3