mirror of
				https://github.com/yattee/yattee.git
				synced 2025-10-31 12:41:57 +00:00 
			
		
		
		
	Fix player delegate methods
This commit is contained in:
		| @@ -37,11 +37,20 @@ final class PlayerState: ObservableObject { | |||||||
|             return |             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 |         InvidiousAPI.shared.video(video!.id).load().onSuccess { response in | ||||||
|             if let video: Video = response.typedContent() { |             if let video: Video = response.typedContent() { | ||||||
|                 self.video = video |                 onSuccess(video) | ||||||
|  |  | ||||||
|                 self.playVideo(video) |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -206,7 +215,7 @@ final class PlayerState: ObservableObject { | |||||||
|  |  | ||||||
|         if let time = savedTime { |         if let time = savedTime { | ||||||
|             logger.info("seeking to \(time.seconds)") |             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 |         true | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     func playerViewControllerWillBeginDismissalTransition(_: AVPlayerViewController) { |     func playerViewControllerDidEndDismissalTransition(_: AVPlayerViewController) { | ||||||
|  |         playingFullScreen = false | ||||||
|         dismiss(animated: false) |         dismiss(animated: false) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     func playerViewController( |     func playerViewController( | ||||||
|         _: AVPlayerViewController, |         _: AVPlayerViewController, | ||||||
|         willBeginFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator |         willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator | ||||||
|     ) { |     ) { | ||||||
|         playingFullScreen = true |         coordinator.animate(alongsideTransition: nil) { context in | ||||||
|  |             if !context.isCancelled { | ||||||
|  |                 self.playingFullScreen = true | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     func playerViewController( |     func playerViewController( | ||||||
|         _: AVPlayerViewController, |         _: AVPlayerViewController, | ||||||
|         willEndFullScreenPresentationWithAnimationCoordinator _: UIViewControllerTransitionCoordinator |         willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator | ||||||
|     ) { |     ) { | ||||||
|         playingFullScreen = false |         coordinator.animate(alongsideTransition: nil) { context in | ||||||
|  |             if !context.isCancelled { | ||||||
|  |                 self.playingFullScreen = false | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Arkadiusz Fal
					Arkadiusz Fal