MediaProjectionAudioSource

@RequiresApi(value = 29)
class MediaProjectionAudioSource(context: Context, projection: MediaProjection, val audioFormat: PcmAudioFormat = PcmAudioFormat(48_000, 2), capturedUid: Int? = null) : PcmAudioSource

Captures media/game playback allowed by other applications, using an authorized projection. The owner retains the projection; closing this audio source does not stop screen capture. This application's playback is excluded to prevent feedback or double-mixing asset audio.

Constructors

Link copied to clipboard
constructor(context: Context, projection: MediaProjection, audioFormat: PcmAudioFormat = PcmAudioFormat(48_000, 2), capturedUid: Int? = null)

Properties

Link copied to clipboard
open override val audioFormat: PcmAudioFormat
Link copied to clipboard
open override var isMuted: Boolean

Whether captured audio is replaced with silence.

Functions

Link copied to clipboard
open suspend override fun close(): Result<Unit>

Closes the source and returns the result of releasing its capture resources.

Link copied to clipboard
open suspend override fun open(mixer: MediaMixer): Result<Unit>

Opens the source for the given mixer and returns the result of initialization.

Link copied to clipboard
open override fun read(track: Int): MediaBuffer

Reads audio for the given track.