title: AVPlayer get rid of black bars/background at top & bottom (Swift)
body: <p>Quick question, does anybody know how i can get rid of the black bars at the top and bottom of my video? I just started using AVPlayer and i'm just removing codes here and there in attempt to remove the black layers. Appreciate those who can help me, Thanks!</p>
  
  <p>UIViewController</p>
  
  <pre><code>import UIKit
  import AVKit
  import AVFoundation
  private var looper: AVPlayerLooper?
  
  class ViewController: UIViewController {
  
      override func viewDidLoad() {
          super.viewDidLoad()
          let path = Bundle.main.path(forResource: "Innie-Kiss", ofType:"mp4")
          let player = AVQueuePlayer(url: URL(fileURLWithPath: path!))
          looper = AVPlayerLooper(player: player, templateItem: AVPlayerItem(asset: AVAsset(url: URL(fileURLWithPath: path!))))
          let controller = AVPlayerViewController()
          controller.player = player
          let screenSize = UIScreen.main.bounds.size
          let videoFrame = CGRect(x: 0, y: 200, width: screenSize.width, height: (screenSize.height - 130) / 2)
          controller.view.frame = videoFrame
          self.view.addSubview(controller.view)
          player.play()
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/PAKvK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PAKvK.png" alt="enter image description here"></a></p>