From 398364fa187d0559c39462366a61dd0b25652e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Sikora?= Date: Fri, 23 Oct 2026 05:23:08 +0200 Subject: [PATCH] fix(ios): keep background music playing during remote sessions (#16660) Configure the iOS audio session with the ambient category so remote playback mixes with other apps while respecting Silent mode and lock. Log configuration errors and leave audio activation to playback. Signed-off-by: Rafal --- flutter/ios/Runner/AppDelegate.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flutter/ios/Runner/AppDelegate.swift b/flutter/ios/Runner/AppDelegate.swift index d9333b706..1c9e71b50 100644 --- a/flutter/ios/Runner/AppDelegate.swift +++ b/flutter/ios/Runner/AppDelegate.swift @@ -1,5 +1,6 @@ import UIKit import Flutter +import AVFoundation @main @objc class AppDelegate: FlutterAppDelegate { @@ -8,6 +9,12 @@ import Flutter didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) + do { + // Mix remote audio with other apps while still respecting silent mode. + try AVAudioSession.sharedInstance().setCategory(.ambient) + } catch { + NSLog("Failed to configure audio mixing: %@", error.localizedDescription) + } dummyMethodToEnforceBundling(); return super.application(application, didFinishLaunchingWithOptions: launchOptions) }