Cancel loading assets on switching backend

This commit is contained in:
Arkadiusz Fal
2022-11-13 13:28:25 +01:00
parent fe9b7c03ca
commit 815d0b3ae8
4 changed files with 18 additions and 1 deletions

View File

@@ -62,7 +62,10 @@ final class AVPlayerBackend: PlayerBackend {
var aspectRatio: Double {
#if os(iOS)
videoWidth! / videoHeight!
guard let videoWidth, let videoHeight else {
return VideoPlayerView.defaultAspectRatio
}
return videoWidth / videoHeight
#else
VideoPlayerView.defaultAspectRatio
#endif
@@ -170,6 +173,11 @@ final class AVPlayerBackend: PlayerBackend {
avPlayer.replaceCurrentItem(with: nil)
}
func cancelLoads() {
asset?.cancelLoading()
composition.cancelLoading()
}
func seek(to time: CMTime, seekType _: SeekType, completionHandler: ((Bool) -> Void)?) {
guard !model.live else { return }