 
         self.backgroundColor = UIColor.blackColor()
 
-        if #available(iOS 9.0, *) {
-
-            self.avPlayerViewController.delegate = self.delegate
-        }
-
         self.avPlayerViewController.addObserver(
             self,
             forKeyPath: avPlayerViewControllerReadyForDisplayKey,


    func applicationDidEnterBackground(notification: NSNotification) {

        self.avPlayerViewController.player = nil
    }

    func applicationWillEnterForeground(notification: NSNotification) {

        self.avPlayerViewController.player = self.player
    }



    public var minimumBufferDuration: Double = 5.0

    public weak var delegate: KKPlayerViewControllerDelegate? {

        didSet {

            if #available(iOS 9.0, *) {

                self.avPlayerViewController.delegate = self.delegate
            }
        }
    }

    // MARK: Private properties

