Hi all.
I'm trying to create custom controls for AVPlayer and managed to do it.
Last thing I want to achieve is making the player go full screen while it is in-line mode, inside UICollectionViewCell, on device rotation.
I'm using this code to present the player in full screen:
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
collectionView?.collectionViewLayout.invalidateLayout()
let sourceVC = self
let destinationVC = LandscapePlayerViewController()
// LandscapePlayerViewController also in view hierarchy within UICollectionViewCell
destinationVC.modalPresentationStyle = .fullScreen
sourceVC.present(destinationVC, animated: true)
}
This does the trick, but for some reason the player presents empty. It doesn't pass the playing video to presented full screen player.
Any suggestions?
Thank you!