Add PiP for iOS

This commit is contained in:
Arkadiusz Fal
2022-05-20 23:23:14 +02:00
parent a93b9a2fe5
commit acf9af936a
9 changed files with 137 additions and 21 deletions

View File

@@ -226,6 +226,17 @@ struct VideoPlayerView: View {
})
case .appleAVPlayer:
player.avPlayerView
#if os(iOS)
.onAppear {
player.pipController = .init(playerLayer: player.playerLayerView.playerLayer)
let pipDelegate = PiPDelegate()
pipDelegate.player = player
player.pipDelegate = pipDelegate
player.pipController!.delegate = pipDelegate
player.playerLayerView.playerLayer.player = player.avPlayerBackend.avPlayer
}
#endif
}
#if !os(tvOS)