SystemAudioCapture class

Class for capturing system audio (audio output from the device).

This class allows you to capture audio that is being played by the system, such as music, videos, or other applications. It requires screen recording permissions on macOS.

Example:

final systemCapture = SystemAudioCapture(
  config: SystemAudioConfig(
    sampleRate: 44100,
    channels: 2,
  ),
);

await systemCapture.startCapture();

// Listen to audio stream
systemCapture.audioStream?.listen((audioData) {
  // Process audio bytes
  print('Received ${audioData.length} bytes');
});

// Listen to decibel readings
systemCapture.decibelStream?.listen((data) {
  print('Decibel: ${data.decibel} dB');
});

// Stop when done
await systemCapture.stopCapture();
Inheritance

Constructors

SystemAudioCapture({SystemAudioConfig? config})
Creates a new SystemAudioCapture instance.

Properties

audioStream Stream<Uint8List>?
Stream of raw audio data bytes from system audio capture.
no setter
decibelStream Stream<DecibelData>?
Stream of system audio decibel (dB) readings.
no setter
hashCode int
The hash code for this object.
no setterinherited
isRecording bool
Whether system audio capture is currently recording.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusStream Stream<SystemAudioStatus>?
Stream of system audio capture status updates.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestPermissions() Future<bool>
Requests necessary permissions for system audio capture.
startCapture({SystemAudioConfig? config}) Future<void>
Starts capturing system audio.
stopCapture() Future<void>
Stops capturing system audio.
toString() String
A string representation of this object.
inherited
updateConfig(SystemAudioConfig config) → void
Updates the audio capture configuration.

Operators

operator ==(Object other) bool
The equality operator.
inherited