1

I use AVPlayer to play video on my SwiftUI project but I notice the video has black layouts around it. Here is how it looks like:

enter image description here

Here is the code:

struct ContentView: View {
    public var body: some View {
        VideoPlayer(player: AVPlayer(url:  URL(string: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4")!))
            .frame(maxWidth: .infinity)
            .frame(height: 350)
    }
}

How do I remove the black layout?

Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
shekwo
  • 1,411
  • 1
  • 20
  • 50

0 Answers0