AVPlayerViewController has incorrect size of content overlay view

Originator:oleg.oleksan
Number:rdar://6468254622 Date Originated:09/28/17
Status:Open Resolved:No
Product:iOS SDK Product Version:iOS 11.0 beta (15A5370a)
Classification:Bug Reproducible:100%
 
Area:
AVKit

Summary:
AVPlayerViewController shows the overlay view at the top. The view has incorrect size in fullscreen and windowed modes. 

Steps to reproduce:
1. Launch the project on iOS 11 https://github.com/sample-repo/AVPlayerViewController-Bug/tree/master/AVPlayerViewController-Bug-iOS11.
2. Launch the project on iOS 10 https://github.com/sample-repo/AVPlayerViewController-Bug/tree/master/AVPlayerViewController-Bug-iOS10.
3. Compare results (see Readme https://github.com/sample-repo/AVPlayerViewController-Bug).

Expected Results:
Content overlay view has correct size to attach custom views at center/bottom/top. 
According to documentation: "Use the content overlay view to add additional custom views between the video content and the controls."

Version: 
iOS 11 beta 9.

Notes:

Comments

How did you get such a high bug ID number?

By indiekiduk at Oct. 4, 2017, 12:12 a.m. (reply...)

Got Apple' response

Until a fix is incorporated into a future version of iOS for this problem, developers who need to use autolayout in contentOverlayView subviews should set the property to true manually before adding subviews to it like this:

playerViewController.view.setNeedsLayout() playerViewController.view.layoutIfNeeded() playerViewController.contentOverlayView?.translatesAutoresizingMaskIntoConstraints = true

By oleg.oleksan at Sept. 30, 2017, 11:47 a.m. (reply...)

I messed with this today and it works fine if you don't use auto layout.

`if let overlayView = playerController.contentOverlayView { myView.frame = overlayView.bounds myView.autoresizingMask = [.flexibleWidth, .flexibleHeight] overlayView.addSubview(myView) } `


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!