2

Please, I liked to know how to use the MediaProjection API, from Android, to record system sound that is outputted in an android device? The system sound, that I want to record, is outputted from some user app, in speakers, or in headsets, from an android device.

Attention:

"Please, I don't want to record, or to capture, the screen with the MediaProjection API from Android, but I want to record the system sound with it."!

"Please, I want some code lines in Java, explaining how to use the Media Projection API from Android, too."!

The MediaProjection API webpage is: http://developer.android.com/intl/pt-br/reference/android/media/projection/MediaProjection.html, in Portuguese-Brazilian language. And, in the English language, it is: http://developer.android.com/reference/android/media/projection/MediaProjection.html.

Thanks for some help.

Best Regards,
dsfbi_13052013.

  • 2
    Judging by [the source code](https://android.googlesource.com/platform/frameworks/base/+/master/media/java/android/media/projection/MediaProjection.java#140) it doesn't seem to be possible to record audio. I'm not sure why it says that you can in the documentation. Perhaps they're planning to add that in the future. – Michael Dec 14 '15 at 12:49
  • Thanks for your comment, Michael. – dsfbi_13052013 Dec 14 '15 at 13:07

2 Answers2

4

I liked to know how to use the MediaProjection API, from Android, to record system sound that is outputted in an android device?

Sorry, but that is not possible. The media projection APIs do not record audio.

I don't want to record, or to capture, the screen with the MediaProjection API from Android

The only use of the media projection APIs are "to record, or to capture, the screen".

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • But this [page](https://developer.android.com/reference/android/media/projection/MediaProjection.html) says _A token granting applications the ability to capture screen contents and/or record system audio. The exact capabilities granted depend on the type of MediaProjection._. – Nithi2023 Nov 04 '17 at 15:34
  • 1
    @Nithi2023: The paragraph after that is "A screen capture session can be started through createScreenCaptureIntent(). This grants the ability to capture screen contents, **but not system audio**." (emphasis added) – CommonsWare Nov 04 '17 at 15:39
  • Yea, that page is misleading. seeing the [source](https://android.googlesource.com/platform/frameworks/base/+/75ee9fc/media/java/android/media/projection/MediaProjection.java#144), they didn't implemented anything for audio still. – Nithi2023 Nov 04 '17 at 16:53
  • 2
    Any API or library from google for recording the system audio still isn't there yet? – Jenix Sep 21 '18 at 09:59
2

Comes With Android 10, the MediaProjection API is now SUPPORT Audio Capture! https://medium.com/@juliozynger/media-projection-and-audio-capture-1ca72e271e9c