Remove custom PiP placeholder

This commit is contained in:
Arkadiusz Fal 2022-08-13 16:14:38 +02:00
parent e8dbf46e14
commit 2c81808125

View File

@ -199,23 +199,17 @@ struct VideoPlayerView: View {
}
#else
GeometryReader { geometry in
Group {
if player.playingInPictureInPicture {
pictureInPicturePlaceholder
} else {
PlayerBackendView()
#if !os(tvOS)
.modifier(
VideoPlayerSizeModifier(
geometry: geometry,
aspectRatio: player.aspectRatio,
fullScreen: fullScreenLayout
)
)
.overlay(playerPlaceholder)
#endif
}
}
PlayerBackendView()
#if !os(tvOS)
.modifier(
VideoPlayerSizeModifier(
geometry: geometry,
aspectRatio: player.aspectRatio,
fullScreen: fullScreenLayout
)
)
.overlay(playerPlaceholder)
#endif
.frame(maxWidth: fullScreenLayout ? .infinity : nil, maxHeight: fullScreenLayout ? .infinity : nil)
.onHover { hovering in
hoveringPlayer = hovering
@ -261,7 +255,6 @@ struct VideoPlayerView: View {
}
#endif
}
.background(((colorScheme == .dark || fullScreenLayout) ? Color.black : Color.white).edgesIgnoringSafeArea(.all))
#if os(macOS)
.frame(minWidth: 650)
@ -333,35 +326,6 @@ struct VideoPlayerView: View {
}
}
var pictureInPicturePlaceholder: some View {
HStack {
Spacer()
VStack {
Spacer()
VStack(spacing: 10) {
#if !os(tvOS)
Image(systemName: "pip")
.font(.system(size: 120))
#endif
Text("Playing in Picture in Picture")
}
Spacer()
}
.foregroundColor(.gray)
Spacer()
}
.contextMenu {
Button {
player.closePiP()
} label: {
Label("Exit Picture in Picture", systemImage: "pip.exit")
}
}
.contentShape(Rectangle())
.frame(width: player.playerSize.width, height: player.playerSize.height)
}
#if os(iOS)
var playerDragGesture: some Gesture {
DragGesture(minimumDistance: 0, coordinateSpace: .global)