rajat yadav
rajat yadav

Reputation: 1

Youtube helper player view iOS iPhone X Layout issue

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.sstatic.net/EGyCH.jpg]

Upvotes: 0

Views: 287

Answers (2)

Abandoned Cart
Abandoned Cart

Reputation: 4676

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.

Upvotes: 0

pradip rathod
pradip rathod

Reputation: 368

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

Upvotes: 0

Related Questions