Youtube helper player view iOS iPhone X Layout issue

295 Views Asked by At

Hi all I am facing an strange issue with youtube-ios-player-helper SDK.Youtube helper player view layout is working properly in all iOS devices except iPhone X. The layout gets trimmed from right and bottom in landscape. The screenshot is attached here - [https://i.stack.imgur.com/EGyCH.jpg]

2

There are 2 best solutions below

0
On

May be There is Problem in Auto layout constraint ,you have to give constraint from safe area, i have given Auto layout constraint of top, bottom, leading, trailing from safe area layout guide and its working prefectly fine see screenshot bellow

enter image description here

0
On

The existing answer may work in a strict landscape application, but will render the view invisible when starting in portrait.

I was able to fix the cropping through a set of constraints relative to the SuperView for width, leading, and trailing. I made the playerView size proportional to 1280 x 720 (or 414 x 233) and used an aspect constraint to make the height relative to the width. This is done by setting the playerView constraint relative to itself.

The last component is to set a single constraint for top, bottom, or centered vertically relative to the container in order to keep the playerView placement. In my case, I wanted it centered.