Post

Replies

Boosts

Views

Activity

Reply to AVPlayerViewController deallocated when entering full screen
Hey! I know, little late, but maybe it could help somebody who has this problem too, because i haven't found solution in the whole internet. So this is the line that solved my "deallocated" problem: controller.modalPresentationStyle = UIModalPresentationStyle.overFullScreen And this is the full videoplayer struct: struct CustomVideoPlayer: UIViewControllerRepresentable {     var url:String     func makeUIViewController(context: Context) -> AVPlayerViewController {         let controller = AVPlayerViewController()         let url: String = url         let player1 = AVPlayer(url: URL(string: url)!)         player1.preventsDisplaySleepDuringVideoPlayback = true         player1.allowsExternalPlayback = true         //THIS ALLOWS TO USE IT FULLSCREEN %%%%%%% NO BUG MTHERFKER!         controller.modalPresentationStyle = UIModalPresentationStyle.overFullScreen         controller.videoGravity = .resizeAspectFill         controller.player = player1         return controller     }     func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) {     } }
May ’22