Skip to content

Commit

Permalink
chore: Disable opus on android
Browse files Browse the repository at this point in the history
  • Loading branch information
krille-chan committed Oct 30, 2023
1 parent b96bc45 commit 6718104
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/pages/chat/recording_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ class RecordingDialogState extends State<RecordingDialog> {
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';
Expand All @@ -57,7 +55,7 @@ class RecordingDialogState extends State<RecordingDialog> {
await WakelockPlus.enable();

await _audioRecorder.start(
RecordConfig(
const RecordConfig(
encoder: audioCodec,
autoGain: true,
noiseSuppress: true,
Expand Down

0 comments on commit 6718104

Please sign in to comment.