From cda6dc8b9bcbcd4f3ccc9e95d7d46b67f0b0340d Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 19 Nov 2022 14:09:33 +0100 Subject: [PATCH] Add close item action to AVPlayer on tvOS --- Model/Player/PlayerTVMenu.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Model/Player/PlayerTVMenu.swift b/Model/Player/PlayerTVMenu.swift index 43ab2dc4..72366951 100644 --- a/Model/Player/PlayerTVMenu.swift +++ b/Model/Player/PlayerTVMenu.swift @@ -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? { UIAction(title: "Switch to MPV", image: UIImage(systemName: "m.circle")) { _ in self.avPlayerBackend.controller?.dismiss(animated: false) @@ -89,6 +95,7 @@ extension PlayerModel { #if os(tvOS) avPlayerBackend.controller?.playerView.transportBarCustomMenuItems = [ restoreLastSkippedSegmentAction, + closeCurrentItemAction, rateMenu, streamsMenu, playbackModeMenu,