allows on-screen widget vibration during mic redirection

This commit is contained in:
TrueZhuanjia
2025-09-08 20:24:11 +08:00
parent c0850ce9d2
commit d818f8a7ce
+4 -8
View File
@@ -89,14 +89,7 @@ public class MicHandler: NSObject {
}
}
}
/// 配置音频会话
@objc static func configureAudioSession() throws {
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(.playAndRecord, mode: .default, options: [.defaultToSpeaker])
try audioSession.setActive(true)
}
/// 弹窗提示用户跳转系统设置(英文版)
private static func showSettingsAlert() {
guard let topVC = topViewController() else { return }
@@ -186,6 +179,9 @@ public class MicHandler: NSObject {
private func configureSession() throws {
let session = AVAudioSession.sharedInstance()
try session.setCategory(.playAndRecord, mode: .videoRecording, options: [.mixWithOthers, .defaultToSpeaker, .allowBluetooth])
if #available(iOS 13.0, *) {
try session.setAllowHapticsAndSystemSoundsDuringRecording(true)
}
try session.setActive(true)
}