1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 05:40:32 +05:30

Show asset loading error from AVPlayer

This commit is contained in:
Arkadiusz Fal 2022-08-19 00:36:16 +02:00
parent b169fc91b3
commit fa76f726c5
2 changed files with 6 additions and 7 deletions

View File

@ -459,7 +459,9 @@ final class AVPlayerBackend: PlayerBackend {
self.model.play() self.model.play()
} }
case .failed: case .failed:
self.model.playerError = item.error DispatchQueue.main.async {
self.model.playerError = item.error
}
default: default:
return return

View File

@ -149,13 +149,10 @@ final class PlayerModel: ObservableObject {
var pipController: AVPictureInPictureController? var pipController: AVPictureInPictureController?
var pipDelegate = PiPDelegate() var pipDelegate = PiPDelegate()
@Published var presentingErrorDetails = false
var playerError: Error? { didSet { var playerError: Error? { didSet {
#if !os(tvOS) if let error = playerError {
if !playerError.isNil { navigation.presentAlert(title: "Failed loading video", message: error.localizedDescription)
presentingErrorDetails = true }
}
#endif
}} }}
@Default(.qualityProfiles) var qualityProfiles @Default(.qualityProfiles) var qualityProfiles