Added in API level 29
    AudioPlaybackCaptureConfiguration
class AudioPlaybackCaptureConfiguration
| kotlin.Any | |
| ↳ | android.media.AudioPlaybackCaptureConfiguration | 
Configuration for capturing audio played by other apps. When capturing audio signals played by other apps (and yours), you will only capture a mix of the audio signals played by players (such as AudioTrack or MediaPlayer) which present the following characteristics:
-  the usage value MUST be AudioAttributes.USAGE_UNKNOWNorAudioAttributes.USAGE_GAMEorAudioAttributes.USAGE_MEDIA. All other usages CAN NOT be captured.
-  AND the capture policy set by their app (with AudioManager.setAllowedCapturePolicy) or on each player (withAudioAttributes.Builder.setAllowedCapturePolicy) isAudioAttributes.ALLOW_CAPTURE_BY_ALL, whichever is the most strict.
-  AND their app attribute allowAudioPlaybackCapture in their manifest MUST either be: 
          - set to "true"
-  not set, and their targetSdkVersionMUST be equal to or greater thanandroid.os.Build.VERSION_CODES#Q. Ie. Apps that do not target at least Android Q must explicitly opt-in to be captured by a MediaProjection.
 
- AND their apps MUST be in the same user profile as your app (eg work profile cannot capture user profile apps and vice-versa).
An example for creating a capture configuration for capturing all media playback:
MediaProjection mediaProjection; // Retrieve a audio capable projection from the MediaProjectionManager AudioPlaybackCaptureConfiguration config = new AudioPlaybackCaptureConfiguration.Builder(mediaProjection) .addMatchingUsage(AudioAttributes.USAGE_MEDIA) .build(); AudioRecord record = new AudioRecord.Builder() .setAudioPlaybackCaptureConfig(config) .build();
Summary
| Nested classes | |
|---|---|
| Builder for creating  | |
| Public methods | |
|---|---|
| IntArray | |
| IntArray | |
| IntArray | |
| IntArray | |
| MediaProjection | |
Public methods
getExcludeUids
Added in API level 29
      fun getExcludeUids(): IntArray
| Return | |
|---|---|
| IntArray | the UIDs passed to Builder.excludeUid(int). This value cannot benull. | 
getExcludeUsages
Added in API level 29
      fun getExcludeUsages(): IntArray
getMatchingUids
Added in API level 29
      fun getMatchingUids(): IntArray
| Return | |
|---|---|
| IntArray | the UIDs passed to Builder.addMatchingUid(int). This value cannot benull. | 
getMatchingUsages
Added in API level 29
      fun getMatchingUsages(): IntArray
getMediaProjection
Added in API level 29
      fun getMediaProjection(): MediaProjection
| Return | |
|---|---|
| MediaProjection | the MediaProjectionused to build this object. This value cannot benull. | 
