RecordAudioCubit constructor
RecordAudioCubit({})
Implementation
RecordAudioCubit({
required this.onRecordEnd,
required this.onRecordStart,
required this.onRecordCancel,
required this.maxRecordLength,
}) : super(RecordAudioReady()) {
_myRecorder.openAudioSession().then((value) {
_myRecorder.setSubscriptionDuration(const Duration(milliseconds: 200));
recorderStream = _myRecorder.onProgress!.listen((event) {
Duration current = event.duration;
currentDuration.value = current;
if (maxRecordLength != null) {
if (current.inMilliseconds >= maxRecordLength!.inMilliseconds) {
log('[chat_composer] 🔴 Audio passed max length');
stopRecord();
}
}
});
});
}