mirror of
https://github.com/yattee/yattee.git
synced 2024-11-09 15:58:20 +00:00
Fix player delegate methods
This commit is contained in:
parent
5b0a3458f3
commit
994903f8a7
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,21 +61,30 @@ extension PlayerViewController: AVPlayerViewControllerDelegate {
|
||||
true
|
||||
}
|
||||
|
||||
func playerViewControllerWillBeginDismissalTransition(_: AVPlayerViewController) {
|
||||
func playerViewControllerDidEndDismissalTransition(_: AVPlayerViewController) {
|
||||
playingFullScreen = false
|
||||
dismiss(animated: false)
|
||||
}
|
||||
|
||||
func playerViewController(
|
||||
_: AVPlayerViewController,
|
||||
willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator
|
||||
willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||
) {
|
||||
playingFullScreen = true
|
||||
coordinator.animate(alongsideTransition: nil) { context in
|
||||
if !context.isCancelled {
|
||||
self.playingFullScreen = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func playerViewController(
|
||||
_: AVPlayerViewController,
|
||||
willEndFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator
|
||||
willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||
) {
|
||||
playingFullScreen = false
|
||||
coordinator.animate(alongsideTransition: nil) { context in
|
||||
if !context.isCancelled {
|
||||
self.playingFullScreen = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user