allows on-screen widget vibration during mic redirection

This commit is contained in:
TrueZhuanjia committed 2025-09-08 20:24:11 +08:00
1 parent c0850ce9d2
commit d818f8a7ce
1 file changed
+3 -7
+3 -7
View File
@@ -90,13 +90,6 @@ 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() { private static func showSettingsAlert() {
guard let topVC = topViewController() else { return } guard let topVC = topViewController() else { return }
@@ -186,6 +179,9 @@ public class MicHandler: NSObject {
private func configureSession() throws { private func configureSession() throws {
let session = AVAudioSession.sharedInstance() let session = AVAudioSession.sharedInstance()
try session.setCategory(.playAndRecord, mode: .videoRecording, options: [.mixWithOthers, .defaultToSpeaker, .allowBluetooth]) try session.setCategory(.playAndRecord, mode: .videoRecording, options: [.mixWithOthers, .defaultToSpeaker, .allowBluetooth])
if #available(iOS 13.0, *) {
try session.setAllowHapticsAndSystemSoundsDuringRecording(true)
}
try session.setActive(true) try session.setActive(true)
} }