Reputation: 61
Ok. Here is the question. I have tabBar controller, in tab at index 0 I have a TableView with cells showing video by AVPlayerViewController. For iPhone, when i print content of UIApplication.shared.windows - it has only 2 window - UIWindow and UITextEffectWindow. But for iPad - it has UIWindow, UITextEffectWindow and several PGHostedWindow (3-4 depends on the number of cells with video). What are those PGHostedWindows? It seems to me that they are creating along with AVPlayer when it's view is added to cell's view hierarcy - and it led me to the thought that it may be connected with iPad's ability to show video in "Picture in picture" mode. But even if I set AVPlayerViewController's allowsPictureInPicture to false - those windows are still creating. And the worst part - even if I scroll those cells with video from visible area,or go to another tab - those PGHostedWindows are not deallocated. So the question is - what are those PGHostedWindows/ and how to prevent their creating?
Upvotes: 6
Views: 1251
Reputation: 683
I was trying to debug an AVKit issue with restoring from picture in picture and also noticed and wondered about PGHostedWindow. Like another commenter said, I don't see a reason for concern about its creation or lifetime. My understanding is AVPlayer moves the AVPlayerLayer between windows when moving in/out of PiP, and this window is one that the system manages.
Of note, which led me here: I noticed there is a longstanding issue where any subviews on AVPlayerLayer get clipped by the video after the view gets reinstalled on PiP. Apple's sample code has the same issue if the controls are extended. So maybe there's a few issues with PGHostedWindow, but we're stuck with them.
Upvotes: 0