mirror of
https://github.com/yattee/yattee.git
synced 2025-01-09 06:17:10 +00:00
Minor performance improvement
This commit is contained in:
parent
7972498f2c
commit
5d8e8483d1
@ -222,8 +222,10 @@ 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 {
|
||||||
|
DispatchQueue.main.async {
|
||||||
UIApplication.shared.isIdleTimerDisabled = true
|
UIApplication.shared.isIdleTimerDisabled = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var captions: Captions?
|
var captions: Captions?
|
||||||
|
@ -459,13 +459,17 @@ final class PlayerModel: ObservableObject {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
streamSelection = stream
|
DispatchQueue.global(qos: .userInitiated).async {
|
||||||
playStream(
|
DispatchQueue.main.async {
|
||||||
|
self.streamSelection = stream
|
||||||
|
}
|
||||||
|
self.playStream(
|
||||||
stream,
|
stream,
|
||||||
of: currentVideo,
|
of: currentVideo,
|
||||||
preservingTime: !currentItem.playbackTime.isNil
|
preservingTime: !self.currentItem.playbackTime.isNil
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func handlePresentationChange() {
|
private func handlePresentationChange() {
|
||||||
backend.setNeedsDrawing(presentingPlayer)
|
backend.setNeedsDrawing(presentingPlayer)
|
||||||
|
@ -95,6 +95,8 @@ extension PlayerModel {
|
|||||||
|
|
||||||
func resetSegments() {
|
func resetSegments() {
|
||||||
resetLastSegment()
|
resetLastSegment()
|
||||||
restoredSegments = []
|
DispatchQueue.main.async { [weak self] in
|
||||||
|
self?.restoredSegments = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user