title: Play video from Download URL
body: <p>I have a URL :- "<a href="http://fitnation.theclientdemos.com:9000/media/uploads/videoplayback_3_JtVCHi1" rel="nofollow noreferrer">http://fitnation.theclientdemos.com:9000/media/uploads/videoplayback_3_JtVCHi1</a>"
  When I run this URL on browser, My VDO starts downloads.</p>
  
  <p>Please help to play this video in a view (let view name is:- vdoView)</p>
  
  <p>For this I am trying below code:-</p>
  
  <pre><code>import UIKit
  import AVKit
  import AVFoundation
  
  class VideoViewController: UIViewController {
  
      @IBOutlet weak var vdoView: UIView!
  
      override func viewDidLoad() {
  
          super.viewDidLoad()
  
          getVideo()
      }
  
      func getVideo(){
  
          let videoURL = URL(string: "http://fitnation.theclientdemos.com:9000/media/uploads/videoplayback_3_JtVCHi1")
  
          let player = AVPlayer(url: videoURL!)
          let playerLayer = AVPlayerLayer(player: player)
          playerLayer.frame = self.vdoView.bounds
          self.vdoView.layer.addSublayer(playerLayer)
          player.play()
  
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/iwuzk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iwuzk.png" alt="enter image description here"></a></p>