     }
 
     public required init?(coder aDecoder: NSCoder) {
+        self._playerView = PlayerView(frame: .zero)
+        self._nativePlayerViewController = AVPlayerViewController()
         self._avplayer = AVPlayer()
         self._avplayer.actionAtItemEnd = .pause
         self._timeObserver = nil

    open weak var playbackDelegate: PlayerPlaybackDelegate?

    // configuration
    
    /// Local or remote URL for the file asset to be played.
    ///
    /// - Parameter url: URL of the asset.

 
        self.playbackDelegate = nil
        self.removePlayerLayerObservers()
        if let playerVC = self._nativePlayerViewController {
            playerVC.player = nil
        } else {
            self._playerView.player = nil
        }
    }

    // MARK: - view lifecycle

    open override func viewDidLoad() {
        super.viewDidLoad()

        if useNativeUI {
            self._nativePlayerViewController = AVPlayerViewController()
        }

        if let playerVC = self._nativePlayerViewController {
            self.view.addSubview(playerVC.view)
            playerVC.view.translatesAutoresizingMaskIntoConstraints = false
            self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-\(0)-[subview]-\(0)-|", options: [], metrics: nil, views: ["subview": playerVC.view]))
            self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-\(0)-[subview]-\(0)-|", options: [], metrics: nil, views: ["subview": playerVC.view]))
            self.addChildViewController(playerVC)
        } else {
            self._playerView.playerIsHidden = false
            self.view = self._playerView
        }

        if let url = url {
            setup(url: url)
        } else if let asset = asset {
