build: Update record package
This commit is contained in:
parent
5dfa4c132d
commit
991bba2535
5 changed files with 39 additions and 26 deletions
|
|
@ -626,7 +626,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
}
|
||||
}
|
||||
|
||||
if (await Record().hasPermission() == false) return;
|
||||
if (await AudioRecorder().hasPermission() == false) return;
|
||||
final result = await showDialog<RecordingResult>(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue