|
|
|
@ -28,7 +28,7 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|
|
|
|
|
|
|
|
|
bool error = false;
|
|
|
|
|
String? _recordedPath;
|
|
|
|
|
final _audioRecorder = Record();
|
|
|
|
|
final _audioRecorder = AudioRecorder();
|
|
|
|
|
final List<double> amplitudeTimeline = [];
|
|
|
|
|
|
|
|
|
|
static const int bitRate = 64000;
|
|
|
|
@ -37,7 +37,7 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|
|
|
|
Future<void> startRecording() async {
|
|
|
|
|
try {
|
|
|
|
|
final tempDir = await getTemporaryDirectory();
|
|
|
|
|
_recordedPath =
|
|
|
|
|
final path = _recordedPath =
|
|
|
|
|
'${tempDir.path}/recording${DateTime.now().microsecondsSinceEpoch}.${RecordingDialog.recordingFileType}';
|
|
|
|
|
|
|
|
|
|
final result = await _audioRecorder.hasPermission();
|
|
|
|
@ -55,10 +55,15 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|
|
|
|
: AudioEncoder.aacLc;
|
|
|
|
|
|
|
|
|
|
await _audioRecorder.start(
|
|
|
|
|
encoder: audioCodec,
|
|
|
|
|
path: _recordedPath,
|
|
|
|
|
bitRate: bitRate,
|
|
|
|
|
samplingRate: samplingRate,
|
|
|
|
|
RecordConfig(
|
|
|
|
|
encoder: audioCodec,
|
|
|
|
|
autoGain: true,
|
|
|
|
|
noiseSuppress: true,
|
|
|
|
|
echoCancel: true,
|
|
|
|
|
bitRate: bitRate,
|
|
|
|
|
sampleRate: samplingRate,
|
|
|
|
|
),
|
|
|
|
|
path: path,
|
|
|
|
|
);
|
|
|
|
|
setState(() => _duration = Duration.zero);
|
|
|
|
|
_recorderSubscription?.cancel();
|
|
|
|
|