From b02a54c1e9d2bde29fbd2c33a3e5dc11c53dc247 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 29 Mar 2025 16:41:23 +0800 Subject: [PATCH] :bug: Fix sound mode --- ios/Podfile.lock | 11 +++++++++++ lib/main.dart | 13 ++++++++++++- lib/providers/notification.dart | 8 ++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 33ac9ac..ecdf995 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -189,6 +189,11 @@ PODS: - Flutter - flutter_webrtc - WebRTC-SDK (= 125.6422.06) + - livekit_noise_filter (0.0.1): + - Flutter + - flutter_webrtc + - LiveKitKrispNoiseFilter (= 0.0.7) + - LiveKitKrispNoiseFilter (0.0.7) - media_kit_libs_ios_video (1.0.4): - Flutter - media_kit_video (0.0.1): @@ -283,6 +288,7 @@ DEPENDENCIES: - in_app_review (from `.symlinks/plugins/in_app_review/ios`) - Kingfisher (~> 8.0) - livekit_client (from `.symlinks/plugins/livekit_client/ios`) + - livekit_noise_filter (from `.symlinks/plugins/livekit_noise_filter/ios`) - media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`) - media_kit_video (from `.symlinks/plugins/media_kit_video/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) @@ -315,6 +321,7 @@ SPEC REPOS: - GoogleDataTransport - GoogleUtilities - Kingfisher + - LiveKitKrispNoiseFilter - nanopb - OrderedSet - PromisesObjC @@ -369,6 +376,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/in_app_review/ios" livekit_client: :path: ".symlinks/plugins/livekit_client/ios" + livekit_noise_filter: + :path: ".symlinks/plugins/livekit_noise_filter/ios" media_kit_libs_ios_video: :path: ".symlinks/plugins/media_kit_libs_ios_video/ios" media_kit_video: @@ -438,6 +447,8 @@ SPEC CHECKSUMS: in_app_review: 5596fe56fab799e8edb3561c03d053363ab13457 Kingfisher: 323e5c4ec7983aaace12af655a7b51a7f88a599d livekit_client: 08755cabfa4da4ed455642f460cfbb39bc518070 + livekit_noise_filter: a26aeb1c1eae6db0a023fd2f6ea3ff108c3ecbb0 + LiveKitKrispNoiseFilter: efe418ceca28163ace0ff222bd2cc02384645d84 media_kit_libs_ios_video: 5a18affdb97d1f5d466dc79988b13eff6c5e2854 media_kit_video: 1746e198cb697d1ffb734b1d05ec429d1fcd1474 nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 diff --git a/lib/main.dart b/lib/main.dart index c92383b..3d75910 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -397,7 +397,18 @@ class _AppSplashScreenState extends State<_AppSplashScreen> with TrayListener { if (!cfg.soundEffects) return; final player = AudioPlayer(playerId: 'launch-done-player'); - await player.play(AssetSource('audio/sfx/launch-done.mp3'), volume: 0.8); + await player.play( + AssetSource('audio/sfx/launch-done.mp3'), + volume: 0.8, + ctx: AudioContext( + android: AudioContextAndroid( + contentType: AndroidContentType.sonification, + usageType: AndroidUsageType.notificationEvent, + ), + iOS: AudioContextIOS(category: AVAudioSessionCategory.ambient), + ), + mode: PlayerMode.lowLatency, + ); player.onPlayerComplete.listen((_) { player.dispose(); }); diff --git a/lib/providers/notification.dart b/lib/providers/notification.dart index bbb503d..4d83598 100644 --- a/lib/providers/notification.dart +++ b/lib/providers/notification.dart @@ -106,6 +106,14 @@ class NotificationProvider extends ChangeNotifier { _notifySoundPlayer.play( AssetSource('audio/notify/metal-pipe.mp3'), volume: 0.6, + ctx: AudioContext( + android: AudioContextAndroid( + contentType: AndroidContentType.sonification, + usageType: AndroidUsageType.notificationEvent, + ), + iOS: AudioContextIOS(category: AVAudioSessionCategory.ambient), + ), + mode: PlayerMode.lowLatency, ); } }