Hi, Im looking for a audio format that both android and ios supports. I have been pointed in many directions like this page:
http://developer.android.com/guide/appendix/media-formats.html, and this
https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html#//apple_ref/doc/uid/TP40009767-CH2-SW6. However, when I record the audio on android as a wav, I get back audio/x-wav, when I record it as a mp3 I get back audio/mpeg. I can listen to the audio on android devices but not on ios. I have tried m4a, 3gp. mp4 m4v and so on.
I upload the audio file to a server. I can play the audio ios are recording but not android. However, if I record in m4a format with android, Im able to play it in the browser, but not on the ios device. Can someone please help me??
I record the audio like this
src = "recording.wav";
mediaRec = new Media(src, onSuccess, onError);
get the file in the filesystem like this:
if(devicePlatform == "iOS"){
window.requestFileSystem(LocalFileSystem.TEMPORARY, 1024, gotFS, fail);
}
else if(devicePlatform == "Android"){
window.requestFileSystem(LocalFileSystem.PERSISTENT, 1024, gotFS, fail);
}
and get the base64 encoded string by doing this
function readDataUrl(file) {
var reader = new FileReader();
reader.onloadend = function(evt) {
base = evt.target.result;
document.getElementById("sendAudio").disabled = false;
recordClicked = true;
};
reader.readAsDataURL(file);
}