audio_recorder_mc 1.0.5 copy "audio_recorder_mc: ^1.0.5" to clipboard
audio_recorder_mc: ^1.0.5 copied to clipboard

This is a flutter plugin for recording audio for Android and IOS. You can read the samples from the microphone and choose the desired sample rate.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:audio_recorder_mc/audio_recorder_mc.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool isRecording = false;

  @override
  void initState() {
    super.initState();
  }

  var recorder = AudioRecorderMc()..setup(sampleRate: 8820);
  Stream<double> samples;

  void startRecord() {
    recorder.startRecord.then((stream) {
      setState(() {
        isRecording = true;
      });

      stream.listen((samples) {
        print(samples);
      });
    });
  }

  void stopRecord() {
    recorder.stopRecord.then((value) {
      setState(() {
        isRecording = false;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              RaisedButton(
                  onPressed: () {
                    this.isRecording ? stopRecord() : startRecord();
                  },
                  child: Text(this.isRecording ? 'Stop' : 'Start')),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
30
pub points
21%
popularity

Publisher

unverified uploader

This is a flutter plugin for recording audio for Android and IOS. You can read the samples from the microphone and choose the desired sample rate.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, permission_handler

More

Packages that depend on audio_recorder_mc