mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Minor tvOS layout fixes
This commit is contained in:
parent
993e602ca3
commit
d330771fef
@ -85,12 +85,6 @@ final class PlayerControlsModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func resetTimer() {
|
func resetTimer() {
|
||||||
#if os(tvOS)
|
|
||||||
if !presentingControls {
|
|
||||||
show()
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
removeTimer()
|
removeTimer()
|
||||||
|
|
||||||
guard let player = player, !player.musicMode else {
|
guard let player = player, !player.musicMode else {
|
||||||
|
@ -69,6 +69,9 @@ struct PlayerControls: View {
|
|||||||
.offset(y: -25)
|
.offset(y: -25)
|
||||||
.zIndex(1)
|
.zIndex(1)
|
||||||
}
|
}
|
||||||
|
#if os(tvOS)
|
||||||
|
.offset(y: -100)
|
||||||
|
#endif
|
||||||
.frame(maxWidth: 500)
|
.frame(maxWidth: 500)
|
||||||
.padding(.bottom, 2)
|
.padding(.bottom, 2)
|
||||||
}
|
}
|
||||||
@ -260,7 +263,9 @@ struct PlayerControls: View {
|
|||||||
HStack(spacing: 20) {
|
HStack(spacing: 20) {
|
||||||
restartVideoButton
|
restartVideoButton
|
||||||
advanceToNextItemButton
|
advanceToNextItemButton
|
||||||
|
#if !os(tvOS)
|
||||||
musicModeButton
|
musicModeButton
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,9 @@ struct TimelineView: View {
|
|||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
Text((dragging ? projectedValue : nil)?.formattedAsPlaybackTime(allowZero: true) ?? playerTime.currentPlaybackTime)
|
Text((dragging ? projectedValue : nil)?.formattedAsPlaybackTime(allowZero: true) ?? playerTime.currentPlaybackTime)
|
||||||
.frame(minWidth: 35)
|
.frame(minWidth: 35)
|
||||||
|
#if os(tvOS)
|
||||||
|
.font(.system(size: 20))
|
||||||
|
#endif
|
||||||
|
|
||||||
ZStack(alignment: .center) {
|
ZStack(alignment: .center) {
|
||||||
ZStack(alignment: .leading) {
|
ZStack(alignment: .leading) {
|
||||||
@ -209,6 +212,9 @@ struct TimelineView: View {
|
|||||||
Text(dragging ? playerTime.durationPlaybackTime : playerTime.withoutSegmentsPlaybackTime)
|
Text(dragging ? playerTime.durationPlaybackTime : playerTime.withoutSegmentsPlaybackTime)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 3))
|
.clipShape(RoundedRectangle(cornerRadius: 3))
|
||||||
.frame(minWidth: 35)
|
.frame(minWidth: 35)
|
||||||
|
#if os(tvOS)
|
||||||
|
.font(.system(size: 20))
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 3))
|
.clipShape(RoundedRectangle(cornerRadius: 3))
|
||||||
.font(.system(size: 9).monospacedDigit())
|
.font(.system(size: 9).monospacedDigit())
|
||||||
|
@ -141,22 +141,22 @@ struct VideoPlayerView: View {
|
|||||||
playerView
|
playerView
|
||||||
.ignoresSafeArea(.all, edges: .all)
|
.ignoresSafeArea(.all, edges: .all)
|
||||||
.onMoveCommand { direction in
|
.onMoveCommand { direction in
|
||||||
if direction == .left {
|
if direction == .up || direction == .down {
|
||||||
|
playerControls.show()
|
||||||
|
}
|
||||||
|
|
||||||
playerControls.resetTimer()
|
playerControls.resetTimer()
|
||||||
|
|
||||||
|
guard !playerControls.presentingControls else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if direction == .left {
|
||||||
player.backend.seek(relative: .secondsInDefaultTimescale(-10))
|
player.backend.seek(relative: .secondsInDefaultTimescale(-10))
|
||||||
}
|
}
|
||||||
if direction == .right {
|
if direction == .right {
|
||||||
playerControls.resetTimer()
|
|
||||||
player.backend.seek(relative: .secondsInDefaultTimescale(10))
|
player.backend.seek(relative: .secondsInDefaultTimescale(10))
|
||||||
}
|
}
|
||||||
if direction == .up {
|
|
||||||
playerControls.show()
|
|
||||||
playerControls.resetTimer()
|
|
||||||
}
|
|
||||||
if direction == .down {
|
|
||||||
playerControls.show()
|
|
||||||
playerControls.resetTimer()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GeometryReader { geometry in
|
GeometryReader { geometry in
|
||||||
|
@ -78,9 +78,11 @@ struct VideoContextMenuView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !os(tvOS)
|
||||||
Section {
|
Section {
|
||||||
ShareButton(contentItem: .init(video: video))
|
ShareButton(contentItem: .init(video: video))
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if !inChannelView, !inChannelPlaylistView {
|
if !inChannelView, !inChannelPlaylistView {
|
||||||
Section {
|
Section {
|
||||||
|
Loading…
Reference in New Issue
Block a user