chore: Disable opus on android

This commit is contained in:
Krille 2023-10-30 08:24:15 +01:00
parent b96bc4565d
commit 6718104731
No known key found for this signature in database

View file

@ -38,12 +38,10 @@ class RecordingDialogState extends State<RecordingDialog> {
try { try {
// We try to pick Opus where supported, since that is a codec optimized // We try to pick Opus where supported, since that is a codec optimized
// for speech as well as what the voice messages MSC uses. // for speech as well as what the voice messages MSC uses.
final audioCodec = // Notice: Opus seems not to work on iOS.
(await _audioRecorder.isEncoderSupported(AudioEncoder.opus)) const audioCodec = AudioEncoder.aacLc;
? AudioEncoder.opus
: AudioEncoder.aacLc;
// see https://pub.dev/documentation/record/latest/record/AudioEncoder.html // see https://pub.dev/documentation/record/latest/record/AudioEncoder.html
final fileExtension = audioCodec == AudioEncoder.opus ? "opus" : "m4a"; const fileExtension = "m4a";
final tempDir = await getTemporaryDirectory(); final tempDir = await getTemporaryDirectory();
final path = _recordedPath = final path = _recordedPath =
'${tempDir.path}/recording${DateTime.now().microsecondsSinceEpoch}.$fileExtension'; '${tempDir.path}/recording${DateTime.now().microsecondsSinceEpoch}.$fileExtension';
@ -57,7 +55,7 @@ class RecordingDialogState extends State<RecordingDialog> {
await WakelockPlus.enable(); await WakelockPlus.enable();
await _audioRecorder.start( await _audioRecorder.start(
RecordConfig( const RecordConfig(
encoder: audioCodec, encoder: audioCodec,
autoGain: true, autoGain: true,
noiseSuppress: true, noiseSuppress: true,