Flutter plugin that captures system/app playback audio on Android using the
AudioPlaybackCapture API, introduced in Android 10.
Android only
- Requests screen-capture consent (
MediaProjection) and reuses the token for audio-only capture, so no video is recorded - Captures
USAGE_MEDIA,USAGE_GAME, andUSAGE_UNKNOWNplayback streams - Runs the capture loop in a foreground service so it survives backgrounding
- Fixed output format: 48 kHz, 16-bit PCM, stereo
Playback capture requires API 29+. The manifest already declares
FOREGROUND_SERVICE and FOREGROUND_SERVICE_MEDIA_PROJECTION, so no extra
manifest changes are needed — the MediaProjection consent dialog is the
actual permission gate the user sees.
DRM-protected playback is excluded from capture by the OS itself, not by anything in this plugin.
final tapper = Tapper();
final granted = await tapper.requestCapturePermission(); // shows system dialog
if (granted) {
await tapper.startCapture();
// ... later
await tapper.stopCapture();
}getPlatformVersion() is also exposed and returns the Android release
string, handy as a quick check that the method channel is set up correctly.
Captured audio is written as raw PCM to
<app external files dir>/capture_raw.pcm while capture is running.