 
     override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
         super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+    }
+    
+    deinit {
+        self.player.willMove(toParentViewController: self)
+        self.player.view.removeFromSuperview()
+        self.player.removeFromParentViewController()
     }
 
     // MARK: view lifecycle


let videoUrl = URL(string: "https://v.cdn.vine.co/r/videos/AA3C120C521177175800441692160_38f2cbd1ffb.1.5.13763579289575020226.mp4")!

class ViewController: UIViewController, PlayerDelegate {

    private var player: Player!
    

                self.player.pause()
        }
    }
}

// MARK: - PlayerDelegate

extension ViewController: PlayerDelegate {
    
    func playerReady(_ player: Player) {
    }
