抱歉,我问的问题太笼统了.
Sorry if I am asking too generic question.
我们正在开发可在移动设备上录制和播放音频的应用程序.此应用程序正在为 Android 和 iOS 开发.该应用程序将使用设备麦克风录制音频并将其存储在服务器中.
We are in the process of developing an application which records and plays audio on mobile devices. This application is being developed for both Android and iOS. The application will record audio using device mic and store it in the server.
用户(在 Android 和 iOS 上)可以打开应用程序并播放存储在服务器上的声音.我们使用的声音格式是 AAC.在 iOS 中它工作正常.我们可以录制和播放AAC文件.
User (on Android and iOS) can open the application and play the sound which is stored on the server. The sound format we are using is AAC. In iOS its working fine. We can record and play the AAC files.
但在 Android(三星 S3 和三星 Galaxy Y)上,我们无法以 AAC 格式录制声音.但是在S3中我们可以播放AAC文件.
But on Android (Samsung S3 and Samsung Galaxy Y) we cannot record sound in AAC format. But in S3 we can play the AAC file.
我的问题是,我们应该选择哪种格式在Android(应该支持从2.3到Jellybean)和iOS中进行录制和播放.我们应该使用 MP4 吗?
My question is, which format we should select for recording and playing in Android (should support from 2.3 to Jellybean) and iOS. Should we use MP4?
我们有一个解决方案,在后端,我们可以将音频文件转换为 AAC、MP4 或 3GP,然后根据版本将支持的文件提供给手机.
One solution we have is, on the backend side we can convert the audio file to AAC, MP4 or 3GP and give the supported files to mobiles based on the versions.
推荐答案Android 和 iOS 使用相同的服务器来存储记录.所有记录都被保存,没有任何扩展名.
Android and iOS use the same server to storage records. All records are saved without any extension.
当 Android 从服务器下载记录时,我的应用会添加.aac"扩展名.使用 iOS 时,它会添加.m4a"扩展名.
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.
在 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];安卓:
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);更多推荐
适用于 iOS 和 Android 的音频格式
发布评论