The AMR_NB encoded file recorded by the Android client failed to be played by the iOS device manufacturer. After repeated baidu Google, iOS needs to use AmrToWave conversion, which undoubtedly brings inconvenience to iOS developers. After testing, AAC can solve this problem, and Android itself can use the MediaPlayer class to play, reducing the workload of iOS developers. The code for the sample recording is as follows:

MediaRecoder mediaRecorder = new MediaRecorder();

mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);

mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);

mediaRecorder.setOutputFile(APPCFG.VOICE_FILE);

mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
Copy the code