I have a videoPlayer with controls. These are not visible with iOS11 + no problem up to iOS10
This is a demo with the iPhone8 simulator
iPhone 8 Demo
This is a demo with the iPhoneX simulator. The controls aren't showing at the bottom of the player
iPhone X Demo
I believe this has a lot to do with the new safe area. We are using contentOffset (below) to offset from the top. Changing the value makes no difference. No controls visible
This is the code below I am using to configure the player :
let statusBarHeight: CGFloat = 20
let contentOffset: CGFloat = 50
func setupPlayerView() {
containerView.addSubview(moviePlayerController.view)
moviePlayerController.videoGravity = AVLayerVideoGravity(rawValue: AVLayerVideoGravity.resizeAspect.rawValue)
moviePlayerController.view.sizeToFit()
moviePlayerController.showsPlaybackControls = true
moviePlayerController.view.translatesAutoresizingMaskIntoConstraints = false
if #available(iOS 11.0, *) {
moviePlayerController.view.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: contentOffset).isActive = true
} else {
moviePlayerController.view.topAnchor.constraint(equalTo: topAnchor, constant: statusBarHeight + contentOffset).isActive = true
}
NSLayoutConstraint.activate([
moviePlayerController.view.bottomAnchor.constraint(equalTo: bottomAnchor),
moviePlayerController.view.leftAnchor.constraint(equalTo: leftAnchor),
moviePlayerController.view.rightAnchor.constraint(equalTo: rightAnchor)
])
}
showsPlaybackControls is set to True, this is the default though
Has anyone else ever encountered this issue ?