I have an app which plays video clips on demand. This has worked well in previous versions of Xcode but I've upgraded to 8.3.3 and am having problems with the AVPlayerViewController.
The video plays and displays correctly. The control bar appears at the bottom of the view but does not respond to taps and, once faded out, does not reappear on tapping the video - unless, that is, I tap near the top left of the view.
My guess is that the actual controls are hidden in some kind of overlay which has the wrong size i.e. it does not properly overlay the whole of the video view. Is there some way to force the AVPlayerViewController to relayout?
I've tried adding:
    _playerController!.view.setNeedsLayout()
    _playerController!.view.layoutIfNeeded()
But this has no effect.
Here's my code:
override func viewDidLoad() {
    super.viewDidLoad()
    _player = AVPlayer()
    _playerController = AVPlayerViewController()
    _playerController!.showsPlaybackControls = true
    _playerController!.allowsPictureInPicturePlayback = false
    _playerController!.videoGravity = AVLayerVideoGravityResizeAspectFill
    _playerController!.player = _player
    self.addChildViewController(_playerController!)
    videoView.addSubview(_playerController!.view)
...
override func viewDidLayoutSubviews() {
    let frame = UIScreen.main.bounds        
    _vidWidth = frame.width - 256.0
    _vidHeight = _vidWidth / 854.0 * 480.0
    videoView.frame = CGRect(x: 0, y: 10.0, width: _vidWidth, height: _vidHeight)
    videoView.backgroundColor = UIColor.black
    _playerController?.view.frame = CGRect(x: 0, y: 0, width: _vidWidth, height: _vidHeight)
...
func playVideo(_ clip: Clip) {
    var videoUrl: URL? = nil
    if  clip.offlineLocation != nil && clip.state == 2 {
        _videoPath = clip.offlineLocation!
        videoUrl = URL(fileURLWithPath: _videoPath!)
    }
    else {
        _videoPath = "https://xxxx.cloudfront.net/" + clip.location
        videoUrl = URL(string: _videoPath!)
    }
    NSLog(_videoPath!)
    let asset = AVURLAsset(url:videoUrl!, options:nil)
    let playerItem = AVPlayerItem(asset: asset)
    _player!.replaceCurrentItem(with: playerItem)
    _player!.play()
}
 
    