From 6718104731dd745ea56ed84576c9d592176c3950 Mon Sep 17 00:00:00 2001 From: Krille Date: Mon, 30 Oct 2023 08:24:15 +0100 Subject: [PATCH] chore: Disable opus on android --- lib/pages/chat/recording_dialog.dart | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/pages/chat/recording_dialog.dart b/lib/pages/chat/recording_dialog.dart index 8bf9908c..881727af 100644 --- a/lib/pages/chat/recording_dialog.dart +++ b/lib/pages/chat/recording_dialog.dart @@ -38,12 +38,10 @@ class RecordingDialogState extends State { try { // 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; + // Notice: Opus seems not to work on iOS. + const audioCodec = AudioEncoder.aacLc; // 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 path = _recordedPath = '${tempDir.path}/recording${DateTime.now().microsecondsSinceEpoch}.$fileExtension'; @@ -57,7 +55,7 @@ class RecordingDialogState extends State { await WakelockPlus.enable(); await _audioRecorder.start( - RecordConfig( + const RecordConfig( encoder: audioCodec, autoGain: true, noiseSuppress: true,