Don't draw player when in background

This commit is contained in:
Arkadiusz Fal
2022-06-05 19:12:00 +02:00
parent 024d23e6aa
commit f2eac24a49
2 changed files with 11 additions and 0 deletions

View File

@@ -61,6 +61,11 @@ struct YatteeApp: App {
) { _ in
player.handleEnterForeground()
}
.onReceive(
NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification)
) { _ in
player.handleEnterBackground()
}
#endif
#if os(iOS)
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))