Hello! Same here... At my project some video has playback controller in the list, and some are'nt... weird
Post
Replies
Boosts
Views
Activity
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) {
}
}
I have the same problem. Any solution? :/