Add close item action to AVPlayer on tvOS

This commit is contained in:
Arkadiusz Fal 2022-11-19 14:09:33 +01:00
parent 8054c9f44a
commit cda6dc8b9b

View File

@ -43,6 +43,12 @@ extension PlayerModel {
} }
} }
var closeCurrentItemAction: UIAction {
UIAction(title: "Close video", image: UIImage(systemName: "xmark")) { [weak self] _ in
self?.closeCurrentItem()
}
}
var switchToMPVAction: UIAction? { var switchToMPVAction: UIAction? {
UIAction(title: "Switch to MPV", image: UIImage(systemName: "m.circle")) { _ in UIAction(title: "Switch to MPV", image: UIImage(systemName: "m.circle")) { _ in
self.avPlayerBackend.controller?.dismiss(animated: false) self.avPlayerBackend.controller?.dismiss(animated: false)
@ -89,6 +95,7 @@ extension PlayerModel {
#if os(tvOS) #if os(tvOS)
avPlayerBackend.controller?.playerView.transportBarCustomMenuItems = [ avPlayerBackend.controller?.playerView.transportBarCustomMenuItems = [
restoreLastSkippedSegmentAction, restoreLastSkippedSegmentAction,
closeCurrentItemAction,
rateMenu, rateMenu,
streamsMenu, streamsMenu,
playbackModeMenu, playbackModeMenu,