start method
- {required ProofEntry curProof}
Start recording into file.
Implementation
Future<RecorderState> start({
required ProofEntry curProof,
}) async {
// Check file permissions
final audioPath = await curProof.audioPath();
if (audioPath == null) {
return RecorderState.failed;
}
if (state == RecorderState.ready) {
state = RecorderState.busy;
// Check and request permission
if (await _record.hasPermission()) {
state = RecorderState.recording;
_curProof = curProof; // set current recording proof
await _record.start(const RecordConfig(), path: audioPath);
return state;
} else {
showErrorNotification(tr().microphoneAccessDenied);
state = RecorderState.ready;
return RecorderState.failed;
}
}
return state;
}