Streaming of PCM audio from Android and iOS with a sample rate of 44,100 Hz


On Android you need to add a permission to AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

On iOS enable the following:

  • Capabilities > Background Modes > Audio, AirPlay and Picture in Picture
  • In the Runner Xcode project edit the Info.plist file. Add an entry for 'Privacy - Microphone Usage Description'

When editing the Info.plist file manually, the entries needed are:

<string>YOUR DESCRIPTION</string>

Example Usage

See the file example/lib/main.dart for a fully fledged example app using the plugin.

  AudioStreamer _streamer = AudioStreamer();
  bool _isRecording = false;
  List<double> _audio = [];
  void onAudio(List<double> buffer) {
    double secondsRecorded = _audio.length.toDouble() / _streamer.sampleRate.toDouble();
    print('$secondsRecorded seconds recorded.');

  void start() async {
    try {
      setState(() {
        _isRecording = true;
    } catch (error) {

  void stop() async {
    bool stopped = await _streamer.stop();
    setState(() {
      _isRecording = stopped;