Add tvOS setting to close video with Menu button

When enabled, the Siri remote Menu button stops playback and clears the
queue instead of only collapsing the player, and the explicit top-bar
close (X) button is hidden.
This commit is contained in:
Arkadiusz Fal
2026-04-18 00:29:59 +02:00
parent 13ade8aad3
commit 8f00fe012f
7 changed files with 68 additions and 9 deletions

View File

@@ -170,15 +170,19 @@ struct TVPlayerControlsView: View {
// Close button stops playback and dismisses.
// Menu button only hides the player (keeps background playback),
// so an explicit Close is kept here, icon-only in the top bar.
Button {
onClose()
} label: {
Image(systemName: "xmark")
.font(.system(size: 26, weight: .semibold))
// When `tvOSMenuButtonClosesVideo` is enabled, the Menu button
// takes over this role and the explicit button is hidden.
if appEnvironment?.settingsManager.tvOSMenuButtonClosesVideo != true {
Button {
onClose()
} label: {
Image(systemName: "xmark")
.font(.system(size: 26, weight: .semibold))
}
.buttonStyle(TVCloseButtonStyle())
.focused($focusedControl, equals: .closeButton)
.accessibilityLabel(Text("player.controls.close"))
}
.buttonStyle(TVCloseButtonStyle())
.focused($focusedControl, equals: .closeButton)
.accessibilityLabel(Text("player.controls.close"))
}
}

View File

@@ -667,6 +667,9 @@ struct TVPlayerView: View {
} else if controlsVisible {
// Fifth: hide controls
hideControls()
} else if appEnvironment?.settingsManager.tvOSMenuButtonClosesVideo == true {
// Sixth (Menu-closes mode): fully close the video like the xmark button
closeVideo()
} else {
// Sixth: dismiss player (controls already hidden)
dismissPlayer()