             }
             
             #if os(iOS)
-                guard #available(iOS 9.0, *) else { return }
+                guard #available(iOS 9.0, *), isViewLoaded else { return }
                 
                 let pipController: AVPictureInPictureController? = {
                     if let pipController = self.pictureInPictureController as? AVPictureInPictureController {
                         return pipController
                     } else {
                         guard
-                            let layer = view.layer as? AVPlayerLayer,
+                            let layer = videoView?.playerLayer,
                             props.pictureInPictureActive else { return nil }
                         let pipController = AVPictureInPictureController(playerLayer: layer)
                         pipController?.delegate = self

extension VideoStreamViewController: AVPictureInPictureControllerDelegate {
    public func pictureInPictureControllerDidStopPictureInPicture(
        _ pictureInPictureController: AVPictureInPictureController) {
        self.dispatch?(.pictureInPictureStopped)
    }
}
#endif

    private var timeObserver: Any?
    private var seekerController: SeekerController? = nil
    private var pictureInPictureController: AnyObject?
    
    override public func loadView() {
        view = VideoStreamView()
