AVPlayerViewController black screen after fullscreen zoom

I embedded an AVPlayerViewController inside of my ViewController like that:


        avPlayerViewController.player = AVPlayer(url: viewModel.videoURL)
        avPlayerViewController.delegate = self
        addChild(avPlayerViewController)
        view.addSubview(avPlayerViewController.view)
        avPlayerViewController.view.translatesAutoresizingMaskIntoConstraints = false

        NSLayoutConstraint.activate([
            avPlayerViewController.view.centerXAnchor.constraint(equalTo: videoContainerView.centerXAnchor),
            avPlayerViewController.view.centerYAnchor.constraint(equalTo: videoContainerView.centerYAnchor),
            avPlayerViewController.view.widthAnchor.constraint(equalTo: videoContainerView.widthAnchor),
            avPlayerViewController.view.heightAnchor.constraint(equalTo: videoContainerView.heightAnchor)
        ])
        avPlayerViewController.didMove(toParent: parent)


If video playback is runing I can open fullscreen mode (and leave it). But if I use pinch to zoom the running video, at the moment my fingers lift from screen I can see the running video zoom back to normal size and next all I can see is a black screen. I can still hear the audio from video playback, but no interaction is possible.


Xcode 11.2.1 gets used.


Any solution for this issue known?


Regards,

Kai

Replies

Now things get strange: If I enable landscape support (my app is portait only at the moment) the bug is gone.

Hello! I am also facing the same issue. Moreover, If the user the on the video and then pans the video a little upside in fullscreen mode, again the video becomes black. So unfortunate that Apple hasn't tried this scenario. My app supports only portrait mode but wants the video to be played in landscape mode for fullscreen.


Enabling landscape is not an option for me but yes then that black screen bug is gone. Any other solutions anyone?