Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
Post marked as unsolved with 1 replies, 0 views
Solved, by adding @State annotation to AVPlayer, thanks guys, this question is closed
struct CustomVideoPlayer: UIViewControllerRepresentable {
@State var player: AVPlayer? = nil
func updateUIViewController(_ playerController: AVPlayerViewController, context: Context) {
playerController.modalPresentationStyle = .fullScreen
playerController.allowsPictureInPicturePlayback = true
playerController.canStartPictureInPictureAutomaticallyFromInline = true
playerController.player = player
}
func makeUIViewController(context: Context) -> AVPlayerViewController {
return AVPlayerViewController()
}
}