Android and iOS use the same server to storage records. All records are saved without any extension.
When Android downloads a record from the server, my app adds an ".aac" extension.
When using iOS, it adds an ".m4a" extension.
The same record plays good on both mobile platforms.
Record on iOS:
NSDictionary recorderSettings = [[NSDictionary alloc] initWithObjectsAndKeys:
? ? ? ? ? ? ? ? ? ? ? ? [NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
? ? ? ? ? ? ? ? ? ? ? ? [NSNumber numberWithInt:16000],AVSampleRateKey,
? ? ? ? ? ? ? ? ? ? ? ? [NSNumber numberWithInt:1],AVNumberOfChannelsKey,
? ? ? ? ? ? ? ? ? ? ? ? [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,
? ? ? ? ? ? ? ? ? ? ? ? [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
? ? ? ? ? ? ? ? ? ? ? ? [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
? ? ? ? ? ? ? ? ? ? ? ? nil];
For Android:
myRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
myRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
myRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
myRecorder.setAudioSamplingRate(16000);
myRecorder.setAudioChannels(1);
mRecorder.setOutputFile(fileName);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…