refactor: Change audio codec to opus where supported to have better compatibility with Element

This commit is contained in:
Krille 2023-10-24 09:55:52 +02:00
parent f3798f3ee8
commit 3fb4ad0a83
No known key found for this signature in database

View file

@ -46,7 +46,16 @@ class RecordingDialogState extends State<RecordingDialog> {
return;
}
await WakelockPlus.enable();
// We try to pick Opus where supported, since that is a codec optimized
// for speech as well as what the voice messages MSC uses.
final audioCodec =
(await _audioRecorder.isEncoderSupported(AudioEncoder.opus))
? AudioEncoder.opus
: AudioEncoder.aacLc;
await _audioRecorder.start(
encoder: audioCodec,
path: _recordedPath,
bitRate: bitRate,
samplingRate: samplingRate,