mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Minor performance improvement
This commit is contained in:
parent
c3e2e5c258
commit
b5f8a0fba2
@ -489,6 +489,18 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
if let currentTime = self.currentTime {
|
if let currentTime = self.currentTime {
|
||||||
self.model.handleSegments(at: currentTime)
|
self.model.handleSegments(at: currentTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !os(macOS)
|
||||||
|
guard UIApplication.shared.applicationState != .background else {
|
||||||
|
print("not performing controls updates in background")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if self.controlsUpdates {
|
||||||
|
self.playerTime.duration = self.playerItemDuration ?? .zero
|
||||||
|
self.playerTime.currentTime = self.currentTime ?? .zero
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +342,13 @@ final class MPVBackend: PlayerBackend {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !os(macOS)
|
||||||
|
guard UIApplication.shared.applicationState != .background else {
|
||||||
|
self.logger.info("not performing controls updates in background")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
self.playerTime.currentTime = self.currentTime ?? .zero
|
self.playerTime.currentTime = self.currentTime ?? .zero
|
||||||
self.playerTime.duration = self.playerItemDuration ?? .zero
|
self.playerTime.duration = self.playerItemDuration ?? .zero
|
||||||
}
|
}
|
||||||
|
@ -789,6 +789,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateNowPlayingInfo() {
|
func updateNowPlayingInfo() {
|
||||||
|
#if !os(tvOS)
|
||||||
guard let video = currentItem?.video else {
|
guard let video = currentItem?.video else {
|
||||||
MPNowPlayingInfoCenter.default().nowPlayingInfo = .none
|
MPNowPlayingInfoCenter.default().nowPlayingInfo = .none
|
||||||
return
|
return
|
||||||
@ -819,6 +820,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
|
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateCurrentArtwork() {
|
func updateCurrentArtwork() {
|
||||||
|
Loading…
Reference in New Issue
Block a user