From 299174c9229a5eff853296cceebfa8f0f6896c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 16 Feb 2026 15:51:54 +0100 Subject: [PATCH] feat: Enable audio recording on web --- lib/pages/chat/recording_view_model.dart | 12 ++++-------- lib/utils/platform_infos.dart | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/pages/chat/recording_view_model.dart b/lib/pages/chat/recording_view_model.dart index 3898c4893..65d7caa1b 100644 --- a/lib/pages/chat/recording_view_model.dart +++ b/lib/pages/chat/recording_view_model.dart @@ -61,14 +61,10 @@ class RecordingViewModelState extends State { setState(() {}); try { - final codec = kIsWeb - // Web seems to create webm instead of ogg when using opus encoder - // which does not play on iOS right now. So we use wav for now: - ? AudioEncoder.wav - // Everywhere else we use opus if supported by the platform: - : !PlatformInfos - .isIOS && // Blocked by https://github.com/llfbandit/record/issues/560 - await audioRecorder.isEncoderSupported(AudioEncoder.opus) + final codec = + !PlatformInfos + .isIOS && // Blocked by https://github.com/llfbandit/record/issues/560 + await audioRecorder.isEncoderSupported(AudioEncoder.opus) ? AudioEncoder.opus : AudioEncoder.aacLc; fileName = diff --git a/lib/utils/platform_infos.dart b/lib/utils/platform_infos.dart index 620dce9a2..36cd454c5 100644 --- a/lib/utils/platform_infos.dart +++ b/lib/utils/platform_infos.dart @@ -34,7 +34,7 @@ abstract class PlatformInfos { !PlatformInfos.isWindows && !PlatformInfos.isLinux; /// Web could also record in theory but currently only wav which is too large - static bool get platformCanRecord => (isMobile || isMacOS); + static bool get platformCanRecord => (isMobile || isMacOS || isWeb); static String get clientName => '${AppSettings.applicationName.value} ${isWeb ? 'web' : Platform.operatingSystem}${kReleaseMode ? '' : 'Debug'}';