Sunday, July 19, 2026
HomeiOS Developmentios - Setting video gravity to resizeAspectFill results in some movies with...

ios – Setting video gravity to resizeAspectFill results in some movies with improper side ratios lead to backside and high black bars (Swift)

[ad_1]

I’ve regarded into related questions however I’ve a special difficulty.

So, there are particular movies (which we do not have management over) the place within the side ratio will not be 16:9 however they’re made 16:9 by inserting black bars within the video content material on the highest and backside. In such movies setting the videoGravity to resizeAspectFill nonetheless leaves backside and high bars. This is the code:

if self.playerLayer?.videoGravity == .resizeAspect {
    self.playerLayer?.videoGravity = .resizeAspectFill
} else {
    self.playerLayer?.videoGravity = .resizeAspect
}

I’ve regarded into scaling of the layer by making use of a rework however that results in the subtitles wanting misplaced. Is there every other means in order that we will by some means zoom in additional in order that these black bars are utterly invisible?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments