simple_audio_recorder 0.2.3 copy "simple_audio_recorder: ^0.2.3" to clipboard
simple_audio_recorder: ^0.2.3 copied to clipboard

Simple layout for audio recording

Simple Audio Recorder #

Simple Audio Recorder is a lightweight and user-friendly package that provides a screen for recording audio and returns the file path of the recorded audio. It leverages the power of record, sound_waveform, and wakelock_plus libraries under the hood to ensure a seamless and efficient recording experience.

Installation #

Add the following to your pubspec.yaml file:

dependencies:
  simple_audio_recorder: latest_version

Usage #

Basic Example #

Below is an example of how to use SimpleAudioRecorder:

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

void main() => runApp(const App());

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  String? _audioPath;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Simple Audio Recorder')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            ElevatedButton(
              onPressed: () async {
                final audioPath = await SimpleAudioRecorder.open(
                  context,
                  recordConfig: const RecordConfig(
                    encoder: AudioEncoder.opus,
                  ),
                );
                if (audioPath != null) {
                  setState(() {
                    _audioPath = audioPath;
                  });
                }
              },
              child: const Text('Open Audio Recorder'),
            ),
            if (_audioPath != null) ...[
              const SizedBox(
                height: 24,
              ),
              AudioPlayerWidget(
                key: UniqueKey(),
                audioPath: _audioPath!,
              ),
            ],
          ],
        ),
      ),
    );
  }
}

Contributing #

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License #

Simple Audio Recorder is licensed under the MIT License. See the LICENSE file for more details.

Credits #

Simple Audio Recorder is inspired by sound_waveform.

2
likes
140
points
5
downloads

Publisher

unverified uploader

Weekly Downloads

Simple layout for audio recording

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, just_audio, path_provider, record, sound_waveform, uuid, wakelock_plus

More

Packages that depend on simple_audio_recorder