AVPlayer-SwiftUI icon indicating copy to clipboard operation
AVPlayer-SwiftUI copied to clipboard

Video view is square and has grey borders

Open dhoskins opened this issue 2 years ago • 1 comments

In this example when playing the video, the video view is square (375 * 375) and has the video inside it with grey borders top and bottom.

Simulator Screen Shot - iPhone 13 mini - 2022-09-13 at 16 23 40

How can I get rid of those grey borders and have the video view hug the borders of the video itself?

dhoskins avatar Sep 13 '22 15:09 dhoskins

Hi Douglas! It's a good question! I know you can get the render size of the video from AVPlayer and I imagine UIViewRepresentable can be told that size so the view only takes the required space, though it's not something I've tried myself!

I assume SwiftUI's VideoPlayer takes care of this for you, so maybe you'd be able to use that instead of going into UIKit?

ChrisMash avatar Sep 14 '22 14:09 ChrisMash