record 0.2.1 copy "record: ^0.2.1" to clipboard
record: ^0.2.1 copied to clipboard

outdated

Record audio to file with multiple codecs, bit rate and sampling rate options.

Record audio with a given file path. MediaRecorder for Android an AVAudioRecorder for iOS.

Options #

  • bit rate (Android only, not working on iOs - quality is set to high for now)
  • sampling rate
  • encoder (Android only)
  • output format

Platforms #

Android #

Permissions

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

min SDK: 16

If your path is on external storage, you'll have to check the permission by yourself.

iOs #

<key>NSMicrophoneUsageDescription</key>
<string>We need to access to the microphone to record</string>

min SDK: 8.0

Supported formats & encoders #

enum AudioOutputFormat {
  AAC,
  AMR_NB,
  AMR_WB,
  MPEG_4,
}

enum AudioEncoder {
  AAC,
  AMR_NB,
  AMR_WB,
}

Android #

https://developer.android.com/guide/topics/media/media-formats

iOs #

https://developer.apple.com/documentation/coreaudiotypes/coreaudiotype_constants/1572096-audio_data_format_identifiers

Usage #

// Import package
import 'package:record/record.dart';

// Start recording
await AudioRecorder.start(
    path: 'aFullPath', // required
    outputFormat: AudioOutputFormat.MPEG_4, // by default
    encoder: AudioEncoder.AAC, // by default (does nothing on iOs)
    bitRate: 128000, // by default
    sampleRate: 44100, // by default
    );

// Stop recording
await AudioRecorder.stop();

// Get the state of the recorder
bool isRecording = await Record.isRecording();

// There's nothing to dispose, this done internally.

Warnings #

Not all formats and/or rates are available for each platform.
Be sure to check supported values from the given links above.

531
likes
0
pub points
99%
popularity

Publisher

verified publisheropenapi4j.org

Record audio to file with multiple codecs, bit rate and sampling rate options.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on record