Fix player delegate methods

This commit is contained in:
Arkadiusz Fal
2021-07-30 00:28:28 +02:00
parent 5b0a3458f3
commit 994903f8a7
2 changed files with 27 additions and 9 deletions

View File

@@ -37,11 +37,20 @@ final class PlayerState: ObservableObject {
return
}
loadExtendedVideoDetails(video) { video in
self.video = video
self.playVideo(video)
}
}
func loadExtendedVideoDetails(_ video: Video?, onSuccess: @escaping (Video) -> Void) {
guard video != nil else {
return
}
InvidiousAPI.shared.video(video!.id).load().onSuccess { response in
if let video: Video = response.typedContent() {
self.video = video
self.playVideo(video)
onSuccess(video)
}
}
}
@@ -206,7 +215,7 @@ final class PlayerState: ObservableObject {
if let time = savedTime {
logger.info("seeking to \(time.seconds)")
player.seek(to: time)
player.seek(to: time, toleranceBefore: CMTime.zero, toleranceAfter: CMTime.zero)
}
}