mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Model improvements
This commit is contained in:
@@ -16,15 +16,7 @@ struct Buffering: View {
|
||||
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
|
||||
|
||||
var playerControlsLayout: PlayerControlsLayout {
|
||||
fullScreenLayout ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
}
|
||||
|
||||
var fullScreenLayout: Bool {
|
||||
#if os(iOS)
|
||||
player.playingFullScreen || verticalSizeClass == .compact
|
||||
#else
|
||||
player.playingFullScreen
|
||||
#endif
|
||||
player.playingFullScreen ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
@@ -1,16 +1,11 @@
|
||||
import SwiftUI
|
||||
|
||||
struct NetworkState: View {
|
||||
@EnvironmentObject<PlayerModel> private var player
|
||||
@EnvironmentObject<NetworkStateModel> private var model
|
||||
|
||||
var body: some View {
|
||||
Buffering(state: model.fullStateText)
|
||||
.opacity(visible ? 1 : 0)
|
||||
}
|
||||
|
||||
var visible: Bool {
|
||||
player.isPlaying && ((player.activeBackend == .mpv && model.pausedForCache) || player.isSeeking)
|
||||
.opacity(model.osdVisible ? 1 : 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,68 +15,77 @@ struct Seek: View {
|
||||
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
|
||||
|
||||
var body: some View {
|
||||
Button(action: model.restoreTime) {
|
||||
VStack(spacing: playerControlsLayout.osdSpacing) {
|
||||
ProgressBar(value: model.progress)
|
||||
.frame(maxHeight: playerControlsLayout.osdProgressBarHeight)
|
||||
Group {
|
||||
#if os(tvOS)
|
||||
content
|
||||
.shadow(radius: 3)
|
||||
#else
|
||||
Button(action: model.restoreTime) { content }
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
}
|
||||
.opacity(visible || YatteeApp.isForPreviews ? 1 : 0)
|
||||
}
|
||||
|
||||
timeline
|
||||
var content: some View {
|
||||
VStack(spacing: playerControlsLayout.osdSpacing) {
|
||||
ProgressBar(value: model.progress)
|
||||
.frame(maxHeight: playerControlsLayout.osdProgressBarHeight)
|
||||
|
||||
if model.isSeeking {
|
||||
timeline
|
||||
|
||||
if model.isSeeking {
|
||||
Divider()
|
||||
gestureSeekTime
|
||||
.foregroundColor(.secondary)
|
||||
.font(.system(size: playerControlsLayout.chapterFontSize).monospacedDigit())
|
||||
.frame(height: playerControlsLayout.chapterFontSize + 5)
|
||||
|
||||
if let chapter = projectedChapter {
|
||||
Divider()
|
||||
gestureSeekTime
|
||||
.foregroundColor(.secondary)
|
||||
.font(.system(size: playerControlsLayout.chapterFontSize).monospacedDigit())
|
||||
.frame(height: playerControlsLayout.chapterFontSize + 5)
|
||||
|
||||
if let chapter = projectedChapter {
|
||||
Text(chapter.title)
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.system(size: playerControlsLayout.chapterFontSize))
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
if let segment = projectedSegment {
|
||||
Text(SponsorBlockAPI.categoryDescription(segment.category) ?? "Sponsor")
|
||||
.font(.system(size: playerControlsLayout.segmentFontSize))
|
||||
.foregroundColor(Color("AppRedColor"))
|
||||
}
|
||||
} else {
|
||||
#if !os(tvOS)
|
||||
if !model.restoreSeekTime.isNil {
|
||||
Divider()
|
||||
Text(chapter.title)
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.system(size: playerControlsLayout.chapterFontSize))
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
Label(model.restoreSeekPlaybackTime, systemImage: "arrow.counterclockwise")
|
||||
.foregroundColor(.secondary)
|
||||
.font(.system(size: playerControlsLayout.chapterFontSize).monospacedDigit())
|
||||
.frame(height: playerControlsLayout.chapterFontSize + 5)
|
||||
}
|
||||
if let segment = projectedSegment {
|
||||
Text(SponsorBlockAPI.categoryDescription(segment.category) ?? "Sponsor")
|
||||
#endif
|
||||
Group {
|
||||
switch model.lastSeekType {
|
||||
case let .segmentSkip(category):
|
||||
Divider()
|
||||
Text(SponsorBlockAPI.categoryDescription(category) ?? "Sponsor")
|
||||
.font(.system(size: playerControlsLayout.segmentFontSize))
|
||||
.foregroundColor(Color("AppRedColor"))
|
||||
}
|
||||
} else {
|
||||
#if !os(tvOS)
|
||||
if !model.restoreSeekTime.isNil {
|
||||
Divider()
|
||||
Label(model.restoreSeekPlaybackTime, systemImage: "arrow.counterclockwise")
|
||||
.foregroundColor(.secondary)
|
||||
.font(.system(size: playerControlsLayout.chapterFontSize).monospacedDigit())
|
||||
.frame(height: playerControlsLayout.chapterFontSize + 5)
|
||||
}
|
||||
#endif
|
||||
Group {
|
||||
switch model.lastSeekType {
|
||||
case let .segmentSkip(category):
|
||||
Divider()
|
||||
Text(SponsorBlockAPI.categoryDescription(category) ?? "Sponsor")
|
||||
.font(.system(size: playerControlsLayout.segmentFontSize))
|
||||
.foregroundColor(Color("AppRedColor"))
|
||||
default:
|
||||
EmptyView()
|
||||
}
|
||||
default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: playerControlsLayout.seekOSDWidth)
|
||||
#if os(tvOS)
|
||||
.padding(30)
|
||||
#else
|
||||
.padding(2)
|
||||
.modifier(ControlBackgroundModifier())
|
||||
.clipShape(RoundedRectangle(cornerRadius: 3))
|
||||
#endif
|
||||
|
||||
.foregroundColor(.primary)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.opacity(visible || YatteeApp.isForPreviews ? 1 : 0)
|
||||
.frame(maxWidth: playerControlsLayout.seekOSDWidth)
|
||||
#if os(tvOS)
|
||||
.padding(30)
|
||||
#else
|
||||
.padding(2)
|
||||
.modifier(ControlBackgroundModifier())
|
||||
.clipShape(RoundedRectangle(cornerRadius: 3))
|
||||
#endif
|
||||
|
||||
.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
var timeline: some View {
|
||||
@@ -121,16 +130,7 @@ struct Seek: View {
|
||||
}
|
||||
|
||||
var playerControlsLayout: PlayerControlsLayout {
|
||||
fullScreenLayout ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
}
|
||||
|
||||
var fullScreenLayout: Bool {
|
||||
guard let player = model.player else { return false }
|
||||
#if os(iOS)
|
||||
return player.playingFullScreen || verticalSizeClass == .compact
|
||||
#else
|
||||
return player.playingFullScreen
|
||||
#endif
|
||||
(model.player?.playingFullScreen ?? false) ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@ struct PlayerControls: View {
|
||||
private var player: PlayerModel!
|
||||
private var thumbnails: ThumbnailsModel!
|
||||
|
||||
@EnvironmentObject<PlayerControlsModel> private var model
|
||||
@ObservedObject private var model = PlayerControlsModel.shared
|
||||
|
||||
#if os(iOS)
|
||||
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
||||
@@ -34,8 +34,10 @@ struct PlayerControls: View {
|
||||
@Default(.playerControlsLayout) private var regularPlayerControlsLayout
|
||||
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
|
||||
|
||||
private let controlsOverlayModel = ControlOverlaysModel.shared
|
||||
|
||||
var playerControlsLayout: PlayerControlsLayout {
|
||||
fullScreenLayout ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
player.playingFullScreen ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
}
|
||||
|
||||
init(player: PlayerModel, thumbnails: ThumbnailsModel) {
|
||||
@@ -90,7 +92,7 @@ struct PlayerControls: View {
|
||||
buttonsBar
|
||||
|
||||
HStack {
|
||||
if !player.currentVideo.isNil, fullScreenLayout {
|
||||
if !player.currentVideo.isNil, player.playingFullScreen {
|
||||
Button {
|
||||
withAnimation(Self.animation) {
|
||||
model.presentingDetailsOverlay = true
|
||||
@@ -160,7 +162,8 @@ struct PlayerControls: View {
|
||||
.offset(y: -playerControlsLayout.timelineHeight - 5)
|
||||
#endif
|
||||
}
|
||||
}.opacity(model.presentingControls && !model.presentingOverlays ? 1 : 0)
|
||||
}
|
||||
.opacity(model.presentingControls ? 1 : 0)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
@@ -193,7 +196,7 @@ struct PlayerControls: View {
|
||||
guard player.presentingPlayer else { return }
|
||||
if value == "swipe down", !model.presentingControls, !model.presentingOverlays {
|
||||
withAnimation(Self.animation) {
|
||||
model.presentingControlsOverlay = true
|
||||
controlsOverlayModel.presenting = false
|
||||
}
|
||||
} else {
|
||||
model.show()
|
||||
@@ -302,19 +305,19 @@ struct PlayerControls: View {
|
||||
var fullscreenButton: some View {
|
||||
button(
|
||||
"Fullscreen",
|
||||
systemImage: fullScreenLayout ? "arrow.down.right.and.arrow.up.left" : "arrow.up.left.and.arrow.down.right"
|
||||
systemImage: player.playingFullScreen ? "arrow.down.right.and.arrow.up.left" : "arrow.up.left.and.arrow.down.right"
|
||||
) {
|
||||
player.toggleFullscreen(fullScreenLayout)
|
||||
player.toggleFullscreen(player.playingFullScreen)
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.keyboardShortcut(fullScreenLayout ? .cancelAction : .defaultAction)
|
||||
.keyboardShortcut(player.playingFullScreen ? .cancelAction : .defaultAction)
|
||||
#endif
|
||||
}
|
||||
|
||||
private var settingsButton: some View {
|
||||
button("settings", systemImage: "gearshape") {
|
||||
withAnimation(Self.animation) {
|
||||
model.presentingControlsOverlay.toggle()
|
||||
controlsOverlayModel.toggle()
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
@@ -492,14 +495,6 @@ struct PlayerControls: View {
|
||||
.modifier(ControlBackgroundModifier(enabled: useBackground))
|
||||
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
||||
}
|
||||
|
||||
var fullScreenLayout: Bool {
|
||||
#if os(iOS)
|
||||
player.playingFullScreen || verticalSizeClass == .compact
|
||||
#else
|
||||
player.playingFullScreen
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
struct PlayerControls_Previews: PreviewProvider {
|
||||
|
@@ -47,16 +47,16 @@ struct TVControls: UIViewRepresentable {
|
||||
func updateUIView(_: UIView, context _: Context) {}
|
||||
|
||||
func makeCoordinator() -> TVControls.Coordinator {
|
||||
Coordinator(controlsArea, model: model)
|
||||
Coordinator(controlsArea)
|
||||
}
|
||||
|
||||
final class Coordinator: NSObject {
|
||||
private let view: UIView
|
||||
private let model: PlayerControlsModel
|
||||
|
||||
init(_ view: UIView, model: PlayerControlsModel) {
|
||||
init(_ view: UIView) {
|
||||
self.view = view
|
||||
self.model = model
|
||||
model = .shared
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@@ -53,15 +53,7 @@ struct TimelineView: View {
|
||||
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
|
||||
|
||||
var playerControlsLayout: PlayerControlsLayout {
|
||||
fullScreenLayout ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
}
|
||||
|
||||
var fullScreenLayout: Bool {
|
||||
#if os(iOS)
|
||||
player.playingFullScreen || verticalSizeClass == .compact
|
||||
#else
|
||||
player.playingFullScreen
|
||||
#endif
|
||||
player.playingFullScreen ? fullScreenPlayerControlsLayout : regularPlayerControlsLayout
|
||||
}
|
||||
|
||||
var chapters: [Chapter] {
|
||||
|
@@ -39,21 +39,13 @@ struct PlayerBackendView: View {
|
||||
#endif
|
||||
}
|
||||
#if os(iOS)
|
||||
.statusBarHidden(fullScreenLayout)
|
||||
#endif
|
||||
}
|
||||
|
||||
var fullScreenLayout: Bool {
|
||||
#if os(iOS)
|
||||
player.playingFullScreen || verticalSizeClass == .compact
|
||||
#else
|
||||
player.playingFullScreen
|
||||
.statusBarHidden(player.playingFullScreen)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
var controlsTopPadding: Double {
|
||||
guard fullScreenLayout else { return 0 }
|
||||
guard player.playingFullScreen else { return 0 }
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom != .pad {
|
||||
return verticalSizeClass == .compact ? SafeArea.insets.top : 0
|
||||
@@ -63,12 +55,12 @@ struct PlayerBackendView: View {
|
||||
}
|
||||
|
||||
var controlsBottomPadding: Double {
|
||||
guard fullScreenLayout else { return 0 }
|
||||
guard player.playingFullScreen else { return 0 }
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom != .pad {
|
||||
return fullScreenLayout && verticalSizeClass == .compact ? SafeArea.insets.bottom : 0
|
||||
return player.playingFullScreen && verticalSizeClass == .compact ? SafeArea.insets.bottom : 0
|
||||
} else {
|
||||
return fullScreenLayout ? SafeArea.insets.bottom : 0
|
||||
return player.playingFullScreen ? SafeArea.insets.bottom : 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -17,7 +17,7 @@ extension VideoPlayerView {
|
||||
}
|
||||
.onChanged { value in
|
||||
guard player.presentingPlayer,
|
||||
!player.controls.presentingControlsOverlay else { return }
|
||||
!controlsOverlayModel.presenting else { return }
|
||||
|
||||
if player.controls.presentingControls, !player.musicMode {
|
||||
player.controls.presentingControls = false
|
||||
@@ -83,7 +83,7 @@ extension VideoPlayerView {
|
||||
isVerticalDrag = false
|
||||
|
||||
guard player.presentingPlayer,
|
||||
!player.controls.presentingControlsOverlay else { return }
|
||||
!controlsOverlayModel.presenting else { return }
|
||||
|
||||
if viewDragOffset > 100 {
|
||||
withAnimation(Constants.overlayAnimation) {
|
||||
|
@@ -12,6 +12,9 @@ struct PlayerGestures: View {
|
||||
singleTapAction: { singleTapAction() },
|
||||
doubleTapAction: {
|
||||
player.backend.seek(relative: .secondsInDefaultTimescale(-10), seekType: .userInteracted)
|
||||
},
|
||||
anyTapAction: {
|
||||
model.update()
|
||||
}
|
||||
)
|
||||
|
||||
|
@@ -231,7 +231,7 @@ struct VideoDetails: View {
|
||||
} else if video.description != nil, !video.description!.isEmpty {
|
||||
VideoDescription(video: video, detailsSize: detailsSize)
|
||||
#if os(iOS)
|
||||
.padding(.bottom, fullScreenLayout ? 10 : SafeArea.insets.bottom)
|
||||
.padding(.bottom, player.playingFullScreen ? 10 : SafeArea.insets.bottom)
|
||||
#endif
|
||||
} else {
|
||||
Text("No description")
|
||||
@@ -243,14 +243,6 @@ struct VideoDetails: View {
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
var fullScreenLayout: Bool {
|
||||
#if os(iOS)
|
||||
return player.playingFullScreen || verticalSizeClass == .compact
|
||||
#else
|
||||
return player.playingFullScreen
|
||||
#endif
|
||||
}
|
||||
|
||||
@ViewBuilder var videoProperties: some View {
|
||||
HStack(spacing: 2) {
|
||||
publishedDateSection
|
||||
|
@@ -70,17 +70,18 @@ struct VideoPlayerView: View {
|
||||
@Default(.seekGestureSpeed) var seekGestureSpeed
|
||||
@Default(.seekGestureSensitivity) var seekGestureSensitivity
|
||||
|
||||
@ObservedObject internal var controlsOverlayModel = ControlOverlaysModel.shared
|
||||
|
||||
var body: some View {
|
||||
ZStack(alignment: overlayAlignment) {
|
||||
videoPlayer
|
||||
.zIndex(-1)
|
||||
#if os(iOS)
|
||||
.gesture(player.controls.presentingControlsOverlay ? videoPlayerCloseControlsOverlayGesture : nil)
|
||||
.gesture(controlsOverlayModel.presenting ? videoPlayerCloseControlsOverlayGesture : nil)
|
||||
#endif
|
||||
|
||||
overlay
|
||||
}
|
||||
.animation(nil, value: player.playerSize)
|
||||
.onAppear {
|
||||
if player.musicMode {
|
||||
player.backend.startControlsUpdates()
|
||||
@@ -184,20 +185,20 @@ struct VideoPlayerView: View {
|
||||
.offset(y: playerOffset)
|
||||
.animation(dragGestureState ? .interactiveSpring(response: 0.05) : .easeOut(duration: 0.2), value: playerOffset)
|
||||
.backport
|
||||
.persistentSystemOverlays(!fullScreenLayout)
|
||||
.persistentSystemOverlays(!player.playingFullScreen)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
var overlay: some View {
|
||||
VStack {
|
||||
if player.controls.presentingControlsOverlay {
|
||||
if controlsOverlayModel.presenting {
|
||||
HStack {
|
||||
HStack {
|
||||
ControlsOverlay()
|
||||
#if os(tvOS)
|
||||
.onExitCommand {
|
||||
withAnimation(Player.controls.animation) {
|
||||
withAnimation(PlayerControls.animation) {
|
||||
player.controls.hideOverlays()
|
||||
}
|
||||
}
|
||||
@@ -210,11 +211,11 @@ struct VideoPlayerView: View {
|
||||
.clipShape(RoundedRectangle(cornerRadius: 4))
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.frame(maxWidth: fullScreenLayout ? .infinity : player.playerSize.width)
|
||||
.frame(maxWidth: player.playingFullScreen ? .infinity : player.playerSize.width)
|
||||
#endif
|
||||
|
||||
#if !os(tvOS)
|
||||
if !fullScreenLayout && sidebarQueue {
|
||||
if !player.playingFullScreen && sidebarQueue {
|
||||
Spacer()
|
||||
}
|
||||
#endif
|
||||
@@ -255,12 +256,12 @@ struct VideoPlayerView: View {
|
||||
}
|
||||
|
||||
var playerWidth: Double? {
|
||||
fullScreenLayout ? (UIScreen.main.bounds.size.width - SafeArea.insets.left - SafeArea.insets.right) : nil
|
||||
player.playingFullScreen ? (UIScreen.main.bounds.size.width - SafeArea.insets.left - SafeArea.insets.right) : nil
|
||||
}
|
||||
|
||||
var playerHeight: Double? {
|
||||
let lockedPortrait = player.lockedOrientation?.contains(.portrait) ?? false
|
||||
return fullScreenLayout ? UIScreen.main.bounds.size.height - (OrientationTracker.shared.currentInterfaceOrientation.isPortrait || lockedPortrait ? (SafeArea.insets.top + SafeArea.insets.bottom) : 0) : nil
|
||||
return player.playingFullScreen ? UIScreen.main.bounds.size.height - (OrientationTracker.shared.currentInterfaceOrientation.isPortrait || lockedPortrait ? (SafeArea.insets.top + SafeArea.insets.bottom) : 0) : nil
|
||||
}
|
||||
|
||||
var playerEdgesIgnoringSafeArea: Edge.Set {
|
||||
@@ -268,7 +269,7 @@ struct VideoPlayerView: View {
|
||||
return []
|
||||
}
|
||||
|
||||
if fullScreenLayout, UIDevice.current.orientation.isLandscape {
|
||||
if player.playingFullScreen, UIDevice.current.orientation.isLandscape {
|
||||
return [.vertical]
|
||||
}
|
||||
|
||||
@@ -296,12 +297,12 @@ struct VideoPlayerView: View {
|
||||
VideoPlayerSizeModifier(
|
||||
geometry: geometry,
|
||||
aspectRatio: player.aspectRatio,
|
||||
fullScreen: fullScreenLayout
|
||||
fullScreen: player.playingFullScreen
|
||||
)
|
||||
)
|
||||
.overlay(playerPlaceholder)
|
||||
#endif
|
||||
.frame(maxWidth: fullScreenLayout ? .infinity : nil, maxHeight: fullScreenLayout ? .infinity : nil)
|
||||
.frame(maxWidth: player.playingFullScreen ? .infinity : nil, maxHeight: player.playingFullScreen ? .infinity : nil)
|
||||
.onHover { hovering in
|
||||
hoveringPlayer = hovering
|
||||
hovering ? player.controls.show() : player.controls.hide()
|
||||
@@ -326,7 +327,7 @@ struct VideoPlayerView: View {
|
||||
.background(Color.black)
|
||||
|
||||
#if !os(tvOS)
|
||||
if !fullScreenLayout {
|
||||
if !player.playingFullScreen {
|
||||
VideoDetails(sidebarQueue: sidebarQueue, fullScreen: $fullScreenDetails)
|
||||
#if os(iOS)
|
||||
.ignoresSafeArea(.all, edges: .bottom)
|
||||
@@ -346,7 +347,7 @@ struct VideoPlayerView: View {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.background(((colorScheme == .dark || fullScreenLayout) ? Color.black : Color.white).edgesIgnoringSafeArea(.all))
|
||||
.background(((colorScheme == .dark || player.playingFullScreen) ? Color.black : Color.white).edgesIgnoringSafeArea(.all))
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 650)
|
||||
#endif
|
||||
@@ -354,9 +355,9 @@ struct VideoPlayerView: View {
|
||||
.onMoveCommand { direction in
|
||||
if direction == .up {
|
||||
player.controls.show()
|
||||
} else if direction == .down, !player.controls.presentingControlsOverlay, !player.controls.presentingControls {
|
||||
withAnimation(Player.controls.animation) {
|
||||
player.controls.presentingControlsOverlay = true
|
||||
} else if direction == .down, !controlsOverlayModel.presenting, !player.controls.presentingControls {
|
||||
withAnimation(PlayerControls.animation) {
|
||||
controlsOverlayModel.presenting = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +386,7 @@ struct VideoPlayerView: View {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if !fullScreenLayout {
|
||||
if !player.playingFullScreen {
|
||||
#if os(iOS)
|
||||
if sidebarQueue {
|
||||
PlayerQueueView(sidebarQueue: true, fullScreen: $fullScreenDetails)
|
||||
@@ -402,19 +403,11 @@ struct VideoPlayerView: View {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.onChange(of: fullScreenLayout) { newValue in
|
||||
.onChange(of: player.playingFullScreen) { newValue in
|
||||
if !newValue { player.controls.hideOverlays() }
|
||||
}
|
||||
#if os(iOS)
|
||||
.statusBar(hidden: fullScreenLayout)
|
||||
#endif
|
||||
}
|
||||
|
||||
var fullScreenLayout: Bool {
|
||||
#if os(iOS)
|
||||
return player.playingFullScreen || verticalSizeClass == .compact
|
||||
#else
|
||||
return player.playingFullScreen
|
||||
.statusBar(hidden: player.playingFullScreen)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -459,7 +452,7 @@ struct VideoPlayerView: View {
|
||||
|
||||
#if os(tvOS)
|
||||
var tvControls: some View {
|
||||
TVControls(model: playerControls, player: player, thumbnails: thumbnails)
|
||||
TVControls(player: player, thumbnails: thumbnails)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user