1
0
mirror of https://github.com/yattee/yattee.git synced 2025-04-28 16:00:33 +05:30

Minor performance improvement

This commit is contained in:
Arkadiusz Fal 2023-05-16 18:51:07 +02:00
parent 7972498f2c
commit 5d8e8483d1
3 changed files with 16 additions and 8 deletions

View File

@ -222,7 +222,9 @@ final class MPVBackend: PlayerBackend {
func playStream(_ stream: Stream, of video: Video, preservingTime: Bool, upgrading: Bool) { func playStream(_ stream: Stream, of video: Video, preservingTime: Bool, upgrading: Bool) {
#if !os(macOS) #if !os(macOS)
if model.presentingPlayer { if model.presentingPlayer {
UIApplication.shared.isIdleTimerDisabled = true DispatchQueue.main.async {
UIApplication.shared.isIdleTimerDisabled = true
}
} }
#endif #endif

View File

@ -459,12 +459,16 @@ final class PlayerModel: ObservableObject {
return return
} }
streamSelection = stream DispatchQueue.global(qos: .userInitiated).async {
playStream( DispatchQueue.main.async {
stream, self.streamSelection = stream
of: currentVideo, }
preservingTime: !currentItem.playbackTime.isNil self.playStream(
) stream,
of: currentVideo,
preservingTime: !self.currentItem.playbackTime.isNil
)
}
} }
private func handlePresentationChange() { private func handlePresentationChange() {

View File

@ -95,6 +95,8 @@ extension PlayerModel {
func resetSegments() { func resetSegments() {
resetLastSegment() resetLastSegment()
restoredSegments = [] DispatchQueue.main.async { [weak self] in
self?.restoredSegments = []
}
} }
} }