Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Record audio on Android with MediaPlayer as source?

On Android, you can record audio from the microphone using the MediaRecorder class: MediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);

I want to record some parts of audio being played by a MediaPlayer instance instead (or some other audio playback device). Is that possible? How would I set a custom audio source?

To summarize; how do I stream audio into the MediaRecorder from an arbitrary audio source?

like image 986
l33t Avatar asked May 01 '11 16:05

l33t


People also ask

Can you record internal audio on Android?

Swipe down from the top of your screen to see the quick settings tiles and tap the screen recorder button. A floating bubble will appear with a record and microphone button. If the latter is crossed out, you're recording internal audio, and if it's not, you get sound straight from your phone's mic.


1 Answers

I don't think there is an API for that for now. Though it IS possible, you would have to have access to the device's buffer, down to the kernel/hardware level. Even if you find a way, I don't think Android would give you permission to do this on application level.

like image 69
Aleksandrus Avatar answered Nov 08 '22 09:11

Aleksandrus