Posts

Post not yet marked as solved
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() } }