Skip to content

Commit

Permalink
fix: windows - unique configuration to replace unsupported bit rate &…
Browse files Browse the repository at this point in the history
… sample rate

see: llfbandit/record/issues/345
  • Loading branch information
brenodt authored and MathJud committed Nov 28, 2024
1 parent 2cc05a4 commit 182fcb0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
20 changes: 13 additions & 7 deletions qaul_ui/lib/screens/home/tabs/chat/widgets/audio_recording.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ class _RecordAudioDialog extends StatefulHookConsumerWidget {
}

class _RecordAudioDialogState extends ConsumerState<_RecordAudioDialog> {
static const kDefaultCodecSettings = RecordConfig(
numChannels: 1,
// 44100 / 2
sampleRate: 22050,
// 128000 / 2
bitRate: 64000,
);
static final kDefaultCodecSettings = Platform.isWindows
? const RecordConfig(numChannels: 1, bitRate: 96000, sampleRate: 44100)
: const RecordConfig(
numChannels: 1,
// 44100 / 2
sampleRate: 22050,
// 128000 / 2
bitRate: 64000,
);

final _log = Logger('RecordAudioDialog');

final audioPlayer = AudioPlayer();
final audioRecorder = AudioRecorder();
Expand Down Expand Up @@ -181,6 +185,7 @@ class _RecordAudioDialogState extends ConsumerState<_RecordAudioDialog> {
await audioRecorder.start(kDefaultCodecSettings, path: path);
}
} catch (e) {
_log.severe("could not start recording: ${e}", e, StackTrace.current);
return;
}
}
Expand All @@ -193,6 +198,7 @@ class _RecordAudioDialogState extends ConsumerState<_RecordAudioDialog> {
audioPath = path!;
});
} catch (e) {
_log.severe("could not stop recording: ${e}", e, StackTrace.current);
return;
}
}
Expand Down
1 change: 1 addition & 0 deletions qaul_ui/lib/screens/home/tabs/chat/widgets/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:image_picker/image_picker.dart';
import 'package:logging/logging.dart';
import 'package:mime/mime.dart';
import 'package:path/path.dart' hide context, Context;
import 'package:path_provider/path_provider.dart';
Expand Down

0 comments on commit 182fcb0

Please sign in to comment.