Files
rustdesk/flutter/ios/Runner/AppDelegate.swift
T
Rafał Sikora 398364fa18 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 <mrsikorarafal@gmail.com>
2026-10-23 11:23:08 +08:00

27 lines
826 B
Swift

import UIKit
import Flutter
import AVFoundation
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
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)
}
public func dummyMethodToEnforceBundling() {
dummy_method_to_enforce_bundling();
session_get_rgba(nil, 0);
}
}