I want to record voice in pure audio format. currently I am using this code
public static void startRecording(String fileName) {
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
String mFileName = Environment.getExternalStorageDirectory()
.getAbsolutePath();
mFileName += "/abc.mp3";
mRecorder.setOutputFile(mFileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
mRecorder.prepare();
mRecorder.start();
} catch (IOException e) {
Log.e(TAG, "prepare() failed");
}
}
This is showing the file as mp3 but the internal file content mime type is "video/mp4". What I need is any audio mime type.
EDIT1 As suggested by Headuck, I changed my code to
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
mFileName += "/abc.aac";
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
The audio got recorded perfectly with "audio/x-hx-aac-adts" mime type. Thanks Headuck.
However my problem is:
I am uploading this file to Google Drive using Cloud endpoints. Then when I open the file it is saying "Oops..! There was a problem in playing this file". I need the file to be played as "MP3" files play.
Does Google Drive supports "ACC" format?. If not please suggest alternatives.
Please help.