I've found several answers (like this one) that tell it is possible to record audio in Android Emulator. But I didn't succeed in finding any suitable setting in Android Virtual Device Manager and I still get an exception on the line recorder.SetAudioSource(AudioSource.Mic)
.
hi try by enabling the audio recording support while creating the virtual device in emulator... While creating device go to hardware part and select new button. A dialog will appear in which select the property combo and select "Audio Recording Support" and give k and apply... Hope it helps...
If you want to use the host audio data, you can enable that option by going to Extended Controls > Microphone and enabling Virtual microphone uses host audio input. This option is automatically disabled whenever the emulator is restarted.
Android Set Permissions to Record Audio To record an audio and save it in device, our app must tell the user that it will access the device's audio input and storage, for that we need to set multiple permissions such as RECORD_AUDIO, STORAGE and WRITE_EXTERNAL_STORAGE in our manifest file.
In the documentation of MediaRecorder
you can see that:
Note: Currently, MediaRecorder does not work on the emulator.
Even in the last API.
But I saw that in the class AudioRecord
, there is no note for this.
More then that, I have found this code:
AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,
8000, AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, 500000);
recorder.startRecording();
From here. And the code's author said that this code works in the emulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With