0

I Have read many posts regarding this question but none have produced a solution to the problem.

I would like to record an audio file on iOS that can be sent and played by an Android device without the file having to be transcoded on a server.

I am aware that iOS only supports recording into certain types and Android can only play certain types as indicated here:

Android supported media types

AVAudioRecorder supported formats

However, according to this if I output a .m4a file with the below settings it should work:

AudioChannelLayout channelLayout;
        memset(&channelLayout, 0, sizeof(AudioChannelLayout));
        channelLayout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo;

         recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
         [NSNumber numberWithInt: kAudioFormatMPEG4AAC], AVFormatIDKey, 
         [NSNumber numberWithFloat:16000.0], AVSampleRateKey,
         [NSNumber numberWithInt:1], AVNumberOfChannelsKey,
         [NSNumber numberWithInt:32000], AVEncoderBitRateKey,
         [NSData dataWithBytes:&channelLayout length:sizeof(AudioChannelLayout)], AVChannelLayoutKey,
         nil];

But it doesn't work.

Now one thing I did notice is that if I try to open a file I recorded on iphone on the web (my computer), it recognizes it as a quicktime file so obviously AVAudioRecorder is setting the outputfiletype of the file to a quicktime format instead of @"public.audio" or something.

So perhaps there is a way of simply changing the filetype on the file created by AVAudioRecorder?

Either way, has anyone successfully solved this issue and if so how?

Community
  • 1
  • 1
Zigglzworth
  • 6,645
  • 9
  • 68
  • 107

1 Answers1

0

well in my case I have the same audio encoding but we save it with .3gp extension and it can be reproduced on Android and iOS. Hope it helps

Gianni Carlo
  • 2,452
  • 1
  • 15
  • 18