AudioRecorderService class
音频录制服务
封装 record 包,提供音频流录制功能 支持缓存录音数据,录音结束后一次性获取完整音频
- Inheritance
-
- Object
- ChangeNotifier
- AudioRecorderService
Constructors
- AudioRecorderService({int sampleRate = 16000, int numChannels = 1})
Properties
- amplitude → double
-
当前振幅 (0.0 - 1.0)
no setter
- audioData → Uint8List
-
获取缓存的所有音频数据(PCM 格式)
no setter
- audioDurationSeconds → double
-
获取音频时长(秒)
no setter
- errorMessage → String
-
错误信息
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isRecording → bool
-
是否正在录音
no setter
- numChannels → int
-
final
- recordingDuration → int
-
录音时长(秒)
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampleRate → int
-
录音配置
final
- state → RecordingState
-
当前状态
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
cancelRecording(
) → Future< void> - 取消录音
-
checkPermission(
) → Future< bool> - 检查并请求麦克风权限
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
startRecording(
{void onAudioData(Uint8List data)?, int? maxDuration, VoidCallback? onMaxDurationReached}) → Future< bool> - 开始录音并缓存音频数据
-
stopRecording(
) → Future< RecordingResult> - 停止录音并返回录音结果
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited