Skip to content

Commit

Permalink
Fix Picture in Picture button documentation (#1039)
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos authored Oct 8, 2024
1 parent 5a9e399 commit be9f641
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Demo/Sources/Players/PlaybackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ private struct MainView: View {
HStack {
HStack(spacing: 20) {
CloseButton()
PiPButton()
if supportsPictureInPicture {
PiPButton()
}
routePickerView()
}
.opacity(shouldHideInterface ? 0 : 1)
Expand Down
2 changes: 1 addition & 1 deletion Demo/Sources/Showcase/PiP/TransitionPiPView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct TransitionPiPView: View {
var body: some View {
VStack {
PlaybackView(player: model.player)
.supportsPictureInPicture(supportsPictureInPicture)
.supportsPictureInPicture(supportsPictureInPicture && !isPresented)

VStack(spacing: 20) {
Toggle("Supports PiP", isOn: $supportsPictureInPicture)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Player/UserInterface/PictureInPictureButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import SwiftUI
/// The button is automatically hidden when Picture in Picture is not available. The body closure is provided a
/// Boolean indicating when Picture in Picture is active.
///
/// For the button to be visible one of its parents must be enabled for in-app Picture in Picture by applying the
/// `View/enabledForInAppPictureInPicture(persisting:)` modifier.
/// For the button to be visible at least one `VideoView` or `SystemVideoView` must be enabled for in-app Picture in
/// Picture by applying the `View/enabledForInAppPictureInPicture(persisting:)` modifier to one of its parent views.
public struct PictureInPictureButton<Content>: View where Content: View {
private let content: (Bool) -> Content

Expand Down

0 comments on commit be9f641

Please sign in to comment.