mirror of
https://github.com/yattee/yattee.git
synced 2025-01-08 22:07:10 +00:00
Player view layout changes
This commit is contained in:
parent
eca685ae29
commit
328119f0e0
@ -100,23 +100,6 @@ struct VideoPlayerView: View {
|
||||
Self._printChanges()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
return GeometryReader { geometry in
|
||||
HSplitView {
|
||||
content
|
||||
}
|
||||
.onAppear {
|
||||
playerSize = geometry.size
|
||||
}
|
||||
}
|
||||
.alert(isPresented: $navigation.presentingAlertInVideoPlayer) { navigation.alert }
|
||||
.onOpenURL { url in
|
||||
URLBookmarkModel.shared.saveBookmark(url)
|
||||
OpenURLHandler.shared.handle(url)
|
||||
}
|
||||
.frame(minWidth: 950, minHeight: 700)
|
||||
#else
|
||||
return GeometryReader { geometry in
|
||||
HStack(spacing: 0) {
|
||||
content
|
||||
@ -124,13 +107,14 @@ struct VideoPlayerView: View {
|
||||
playerSize = geometry.size
|
||||
}
|
||||
}
|
||||
.onChange(of: geometry.size) { size in
|
||||
self.playerSize = size
|
||||
.onChange(of: geometry.size) { _ in
|
||||
self.playerSize = geometry.size
|
||||
}
|
||||
.onChange(of: fullScreenDetails) { value in
|
||||
player.backend.setNeedsDrawing(!value)
|
||||
}
|
||||
#if os(iOS)
|
||||
.padding(.bottom, playerEdgesIgnoringSafeArea == [.bottom] ? 0 : geometry.safeAreaInsets.bottom)
|
||||
.frame(width: playerWidth.isNil ? nil : Double(playerWidth!), height: playerHeight.isNil ? nil : Double(playerHeight!))
|
||||
.ignoresSafeArea(.all, edges: playerEdgesIgnoringSafeArea)
|
||||
.onChange(of: player.presentingPlayer) { newValue in
|
||||
@ -193,7 +177,6 @@ struct VideoPlayerView: View {
|
||||
.backport
|
||||
.persistentSystemOverlays(!fullScreenPlayer)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
func updateSidebarQueue() {
|
||||
@ -287,7 +270,7 @@ struct VideoPlayerView: View {
|
||||
return [.vertical]
|
||||
}
|
||||
|
||||
return []
|
||||
return [.bottom]
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -305,8 +288,9 @@ struct VideoPlayerView: View {
|
||||
.ignoresSafeArea()
|
||||
#else
|
||||
GeometryReader { geometry in
|
||||
ZStack {
|
||||
player.playerBackendView
|
||||
#if !os(tvOS)
|
||||
}
|
||||
.modifier(
|
||||
VideoPlayerSizeModifier(
|
||||
geometry: geometry,
|
||||
@ -314,16 +298,12 @@ struct VideoPlayerView: View {
|
||||
fullScreen: fullScreenPlayer
|
||||
)
|
||||
)
|
||||
.overlay(playerPlaceholder)
|
||||
#endif
|
||||
.frame(maxWidth: fullScreenPlayer ? .infinity : nil, maxHeight: fullScreenPlayer ? .infinity : nil)
|
||||
.onHover { hovering in
|
||||
hoveringPlayer = hovering
|
||||
hovering ? player.controls.show() : player.controls.hide()
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.gesture(player.controls.presentingOverlays ? nil : playerDragGesture)
|
||||
#endif
|
||||
#if os(macOS)
|
||||
.onAppear(perform: {
|
||||
NSEvent.addLocalMonitorForEvents(matching: [.mouseMoved]) {
|
||||
@ -340,9 +320,8 @@ struct VideoPlayerView: View {
|
||||
|
||||
.background(Color.black)
|
||||
|
||||
#if !os(tvOS)
|
||||
if !fullScreenPlayer {
|
||||
VideoDetails(page: $detailsPage, sidebarQueue: $sidebarQueue, fullScreen: $fullScreenDetails, bottomPadding: detailsNeedBottomPadding)
|
||||
VideoDetails(video: player.currentVideo, page: $detailsPage, sidebarQueue: $sidebarQueue, fullScreen: $fullScreenDetails, bottomPadding: detailsNeedBottomPadding)
|
||||
#if os(iOS)
|
||||
.ignoresSafeArea(.all, edges: .bottom)
|
||||
#endif
|
||||
@ -355,8 +334,8 @@ struct VideoPlayerView: View {
|
||||
player.setNeedsDrawing(true)
|
||||
}
|
||||
}
|
||||
.transition(.opacity)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -476,7 +455,7 @@ struct VideoPlayerView: View {
|
||||
.foregroundColor(.gray)
|
||||
#endif
|
||||
}
|
||||
.background(Color.black)
|
||||
.background(colorScheme == .dark ? Color.black : .white)
|
||||
.contentShape(Rectangle())
|
||||
.frame(width: player.playerSize.width, height: player.playerSize.height)
|
||||
}
|
||||
@ -493,7 +472,7 @@ struct VideoPlayerView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
VideoPlayerView()
|
||||
.onAppear {
|
||||
OutroViewModel.shared.prepareForEmptyPlayerPlaceholder(.init(.fixture))
|
||||
WatchNextViewModel.shared.prepareForEmptyPlayerPlaceholder(.init(.fixture))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user