Minor tvOS layout fixes

This commit is contained in:
Arkadiusz Fal 2022-06-26 14:55:23 +02:00
parent 993e602ca3
commit d330771fef
5 changed files with 27 additions and 20 deletions

View File

@ -85,12 +85,6 @@ final class PlayerControlsModel: ObservableObject {
}
func resetTimer() {
#if os(tvOS)
if !presentingControls {
show()
}
#endif
removeTimer()
guard let player = player, !player.musicMode else {

View File

@ -69,6 +69,9 @@ struct PlayerControls: View {
.offset(y: -25)
.zIndex(1)
}
#if os(tvOS)
.offset(y: -100)
#endif
.frame(maxWidth: 500)
.padding(.bottom, 2)
}
@ -260,7 +263,9 @@ struct PlayerControls: View {
HStack(spacing: 20) {
restartVideoButton
advanceToNextItemButton
musicModeButton
#if !os(tvOS)
musicModeButton
#endif
}
.frame(maxWidth: .infinity, alignment: .trailing)
}

View File

@ -109,6 +109,9 @@ struct TimelineView: View {
HStack(spacing: 4) {
Text((dragging ? projectedValue : nil)?.formattedAsPlaybackTime(allowZero: true) ?? playerTime.currentPlaybackTime)
.frame(minWidth: 35)
#if os(tvOS)
.font(.system(size: 20))
#endif
ZStack(alignment: .center) {
ZStack(alignment: .leading) {
@ -209,6 +212,9 @@ struct TimelineView: View {
Text(dragging ? playerTime.durationPlaybackTime : playerTime.withoutSegmentsPlaybackTime)
.clipShape(RoundedRectangle(cornerRadius: 3))
.frame(minWidth: 35)
#if os(tvOS)
.font(.system(size: 20))
#endif
}
.clipShape(RoundedRectangle(cornerRadius: 3))
.font(.system(size: 9).monospacedDigit())

View File

@ -141,22 +141,22 @@ struct VideoPlayerView: View {
playerView
.ignoresSafeArea(.all, edges: .all)
.onMoveCommand { direction in
if direction == .up || direction == .down {
playerControls.show()
}
playerControls.resetTimer()
guard !playerControls.presentingControls else {
return
}
if direction == .left {
playerControls.resetTimer()
player.backend.seek(relative: .secondsInDefaultTimescale(-10))
}
if direction == .right {
playerControls.resetTimer()
player.backend.seek(relative: .secondsInDefaultTimescale(10))
}
if direction == .up {
playerControls.show()
playerControls.resetTimer()
}
if direction == .down {
playerControls.show()
playerControls.resetTimer()
}
}
#else
GeometryReader { geometry in

View File

@ -78,9 +78,11 @@ struct VideoContextMenuView: View {
}
}
Section {
ShareButton(contentItem: .init(video: video))
}
#if !os(tvOS)
Section {
ShareButton(contentItem: .init(video: video))
}
#endif
if !inChannelView, !inChannelPlaylistView {
Section {