I am using the following settings to initialize MediaRecorder. My app is working fine on most devices except Samsung and an error occurs on MediaRecorder.stop().
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
recorder.setAudioEncodingBitRate(16*44100);
recorder.setAudioSamplingRate(44100);
it throws the following error message.
java.lang.IllegalStateException:
at android.media.MediaRecorder._stop (MediaRecorder.java)
at android.media.MediaRecorder.stop (MediaRecorder.java:1440)
at com.appname.stopRecording (add_new.java:4)`
Could this be because I am using MIC as an audio source for Samsung devices instead of VOICE_CALL?