fix pip screen bugs

This commit is contained in:
2026-09-26 17:51:25 +08:00
parent a046790ab0
commit 027171cf59
9 changed files with 400 additions and 381 deletions
+31
View File
@@ -1,3 +1,4 @@
import AVFoundation
import UIKit
import WidgetKit
@@ -93,9 +94,39 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
guard let message = notification.userInfo?["message"] as? String else { return }
HostBridge.shared.showToast(message)
}
NotificationCenter.default.addObserver(
forName: Notification.Name("llmpPrepareAudioSession"),
object: nil,
queue: .main
) { [weak self] _ in
self?.activatePlaybackSession()
}
QqShareHost.shared.prepare()
}
/// iOS 27 起主线程同步 setActive 会报 Hang Risk,改走异步激活。
private func activatePlaybackSession() {
let session = AVAudioSession.sharedInstance()
try? session.setCategory(.playback)
if #available(iOS 27.0, *) {
session.activate(options: []) { activated, error in
DispatchQueue.main.async {
NotificationCenter.default.post(
name: Notification.Name("llmpAudioSessionReady"),
object: nil,
userInfo: ["ok": activated && error == nil]
)
}
}
} else {
try? session.setActive(true)
NotificationCenter.default.post(
name: Notification.Name("llmpAudioSessionReady"),
object: nil
)
}
}
func application(
_ app: UIApplication,
open url: URL,