Merge pull request #998 from krille-chan/krille/update-record-package
build: Update record package
This commit is contained in:
commit
a4e8ffdc7f
5 changed files with 40 additions and 26 deletions
|
|
@ -610,7 +610,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,
|
||||
barrierDismissible: false,
|
||||
|
|
|
|||
|
|
@ -28,16 +28,16 @@ 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;
|
||||
static const int samplingRate = 22050;
|
||||
static const int samplingRate = 44100;
|
||||
|
||||
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();
|
||||
|
|
@ -47,9 +47,15 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|||
}
|
||||
await WakelockPlus.enable();
|
||||
await _audioRecorder.start(
|
||||
path: _recordedPath,
|
||||
bitRate: bitRate,
|
||||
samplingRate: samplingRate,
|
||||
const RecordConfig(
|
||||
bitRate: bitRate,
|
||||
sampleRate: samplingRate,
|
||||
numChannels: 1,
|
||||
autoGain: true,
|
||||
echoCancel: true,
|
||||
noiseSuppress: true,
|
||||
),
|
||||
path: path,
|
||||
);
|
||||
setState(() => _duration = Duration.zero);
|
||||
_recorderSubscription?.cancel();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue