Minor improvements

This commit is contained in:
Arkadiusz Fal 2023-05-25 18:02:50 +02:00
parent 5cfcffc885
commit 24241d3485
2 changed files with 13 additions and 9 deletions

View File

@ -387,7 +387,7 @@ final class PlayerModel: ObservableObject {
if !upgrading, !video.isLocal {
resetSegments()
DispatchQueue.main.async { [weak self] in
DispatchQueue.global(qos: .userInitiated).async { [weak self] in
self?.sponsorBlock.loadSegments(
videoID: video.videoID,
categories: Defaults[.sponsorBlockCategories]
@ -407,15 +407,19 @@ final class PlayerModel: ObservableObject {
resetSegments()
}
(withBackend ?? backend).playStream(
stream,
of: video,
preservingTime: preservingTime,
upgrading: upgrading
)
DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 0.25) {
(withBackend ?? self.backend).playStream(
stream,
of: video,
preservingTime: preservingTime,
upgrading: upgrading
)
}
if !upgrading {
updateCurrentArtwork()
DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 0.5) {
self.updateCurrentArtwork()
}
}
}

View File

@ -75,7 +75,7 @@ final class SponsorBlockAPI: ObservableObject {
self.videoID = videoID
DispatchQueue.main.async { [weak self] in
DispatchQueue.global(qos: .userInitiated).async { [weak self] in
self?.requestSegments(categories: categories, completionHandler: completionHandler)
}
}