title: Please help me that there is a problem playing the video with HTTP Live Streaming using AVPlayer
body: <p>After approximately 1 to 2 seconds of video playback using AVPlayer, the image is crushed like a picture. But the sound comes out. Why is this problem happening?</p>
  <p>issue picture:</p>
  <p><a href="https://i.stack.imgur.com/PiuyX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PiuyX.jpg" alt="enter image description here" /></a></p>
  <p>correct picture:</p>
  <p><a href="https://i.stack.imgur.com/u0hb6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u0hb6.jpg" alt="enter image description here" /></a></p>
  <pre><code>class ViewController: UIViewController {
        
       @IBOutlet weak var playerView: PlayerView!
       let player = AVPlayer()
  
       override func viewDidLoad() {
          super.viewDidLoad()
          
          playerView.player = player
          let playerItem = AVPlayerItem(url: &quot;HLS URL&quot;)
          playerItem.preferredForwardBufferDuration = TimeInterval(3.0)
          self?.playerView.playerLayer.videoGravity = .resizeAspect
          self?.playerView.player?.replaceCurrentItem(with: playerItem)
          self?.playerView.player?.play()
          
       }
  }
  
  
  class PlayerView: UIView {
      var player: AVPlayer? {
          get {
              return playerLayer.player
          }
          set {
              playerLayer.player = newValue
          }
      }
      
      var playerLayer: AVPlayerLayer {
          return layer as! AVPlayerLayer
      }
      
      override static var layerClass: AnyClass {
          return AVPlayerLayer.self
      }
  }
  </code></pre>