parent
dc01804359
commit
b700e17d7e
|
@ -20,6 +20,7 @@ open class VideoGalleryContentViewController: UIViewController, GalleryContentVi
|
||||||
private var statusObservation: NSKeyValueObservation?
|
private var statusObservation: NSKeyValueObservation?
|
||||||
private var rateObservation: NSKeyValueObservation?
|
private var rateObservation: NSKeyValueObservation?
|
||||||
private var hideControlsWorkItem: DispatchWorkItem?
|
private var hideControlsWorkItem: DispatchWorkItem?
|
||||||
|
private var isShowingError = false
|
||||||
|
|
||||||
public init(url: URL, caption: String?) {
|
public init(url: URL, caption: String?) {
|
||||||
self.url = url
|
self.url = url
|
||||||
|
@ -90,12 +91,15 @@ open class VideoGalleryContentViewController: UIViewController, GalleryContentVi
|
||||||
self.container?.setGalleryContentLoading(false)
|
self.container?.setGalleryContentLoading(false)
|
||||||
self.showErrorView(error)
|
self.showErrorView(error)
|
||||||
self.statusObservation = nil
|
self.statusObservation = nil
|
||||||
|
self.overlayVC.setVisible(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private func showErrorView(_ error: any Error) {
|
private func showErrorView(_ error: any Error) {
|
||||||
|
isShowingError = true
|
||||||
|
|
||||||
let image = UIImageView(image: UIImage(systemName: "exclamationmark.triangle.fill")!)
|
let image = UIImageView(image: UIImage(systemName: "exclamationmark.triangle.fill")!)
|
||||||
image.tintColor = .secondaryLabel
|
image.tintColor = .secondaryLabel
|
||||||
image.contentMode = .scaleAspectFit
|
image.contentMode = .scaleAspectFit
|
||||||
|
@ -158,7 +162,7 @@ open class VideoGalleryContentViewController: UIViewController, GalleryContentVi
|
||||||
}
|
}
|
||||||
|
|
||||||
public var presentationAnimation: GalleryContentPresentationAnimation {
|
public var presentationAnimation: GalleryContentPresentationAnimation {
|
||||||
.fromSourceViewWithoutSnapshot
|
isShowingError ? .fade : .fromSourceViewWithoutSnapshot
|
||||||
}
|
}
|
||||||
|
|
||||||
private lazy var overlayVC = VideoOverlayViewController(player: player)
|
private lazy var overlayVC = VideoOverlayViewController(player: player)
|
||||||
|
@ -169,7 +173,9 @@ open class VideoGalleryContentViewController: UIViewController, GalleryContentVi
|
||||||
public private(set) lazy var bottomControlsAccessoryViewController: UIViewController? = VideoControlsViewController(player: player)
|
public private(set) lazy var bottomControlsAccessoryViewController: UIViewController? = VideoControlsViewController(player: player)
|
||||||
|
|
||||||
public func setControlsVisible(_ visible: Bool, animated: Bool, dueToUserInteraction: Bool) {
|
public func setControlsVisible(_ visible: Bool, animated: Bool, dueToUserInteraction: Bool) {
|
||||||
|
if !isShowingError {
|
||||||
overlayVC.setVisible(visible)
|
overlayVC.setVisible(visible)
|
||||||
|
}
|
||||||
|
|
||||||
if !visible {
|
if !visible {
|
||||||
hideControlsWorkItem?.cancel()
|
hideControlsWorkItem?.cancel()
|
||||||
|
|
Loading…
Reference in New Issue