NmRecordAudioRecorder class

NmAudioRecorder on the record plugin: records to a temporary file (a blob on the web) in the platform's format (see nmRecordFormats), returns the bytes on stop and deletes the file. level is the input level 0..1 about 10 times a second; cancel discards the recording. Use it with NmVoiceMode.server (NmServerVoiceInput).

Constructors

NmRecordAudioRecorder({NmRecordBackend? backend, NmRecordingFiles? files, List<NmRecordFormat>? formats, int sampleRate = 16000, int numChannels = 1, Duration levelInterval = const Duration(milliseconds: 100)})
Creates an NmRecordAudioRecorder. formats overrides the platform's list; backend and files replace the plugin and the file system (tests).

Properties

hashCode → int
The hash code for this object.
no setterinherited
isRecording → bool
Recording now.
no setter
level → Stream<double>
The input level 0..1 while recording, about 10 times a second.
no setter
levelInterval → Duration
How often level updates.
final
numChannels → int
Channels (mono by default).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sampleRate → int
Sample rate in Hz (16 kHz is enough for speech).
final

Methods

cancel() → void
Stops recording and discards it (releases the microphone).
dispose() → Future<void>
Stops any recording and releases the plugin.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start() → Future<bool>
Starts recording; false when the microphone was refused.
stop() → Future<NmRecording?>
Stops recording; null when nothing was recorded.
toString() → String
A string representation of this object.
inherited

Operators

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