     /// Player view's initial background color.
     open var layerBackgroundColor: UIColor? {
         get {
-            guard let backgroundColor = self._playerView.playerLayer.backgroundColor
-            else {
-                return nil
-            }
-            return UIColor(cgColor: backgroundColor)
+            guard let backgroundColor = self._playerView.playerBackgroundColor
+                else {
+                    return nil
+            }
+            return backgroundColor
         }
         set {
-            self._playerView.playerLayer.backgroundColor = newValue?.cgColor
+            self._playerView.playerBackgroundColor = newValue
         }
     }
     

            }
        
        } else if context == &PlayerLayerObserverContext {
            if self._playerView.playerLayer.isReadyForDisplay {
                self.executeClosureOnMainQueueIfNecessary {
                    self.playerDelegate?.playerReady(self)
                }


    var player: AVPlayer? {
        get {
            if let playerVC = self.playerViewController {
                return playerVC.player
            }
            return self.playerLayer.player
        }
        set {
            if let playerVC = self.playerViewController {
                playerVC.player = newValue
            } else {
                self.playerLayer.player = newValue
            }
        }
    }

    var fillMode: PlayerFillMode {
        get {
            if let playerVC = self.playerViewController {
                return playerVC.videoGravity
            }
            return self.playerLayer.videoGravity.rawValue
        }
        set {
            if let playerVC = self.playerViewController {
                playerVC.videoGravity = newValue
            } else {
                self.playerLayer.videoGravity = AVLayerVideoGravity(rawValue: newValue)
            }
        }
    }

    var playerIsHidden: Bool {
        get {
            if let playerVC = self.playerViewController {
                return playerVC.view.isHidden
            }
            return self.playerLayer.isHidden
        }
        set {
            if let playerVC = self.playerViewController {
                playerVC.view.isHidden = newValue
            } else {
                self.playerLayer.isHidden = newValue
            }
        }
    }

    var playerBackgroundColor: UIColor? {
        get {
            if let playerVC = self.playerViewController {
                return playerVC.view.backgroundColor
            } else if let cgColor = self.playerLayer.backgroundColor {
                return UIColor(cgColor: cgColor)
            }
            return nil
        }
        set {
            if let playerVC = self.playerViewController {
                playerVC.view.backgroundColor = newValue
            } else {
                self.playerLayer.backgroundColor = newValue?.cgColor
            }
        }
    }

    var playerFillMode: String {
        get {
            if let playerVC = self.playerViewController {
                return playerVC.view.layer.fillMode
            }
            return self.playerLayer.fillMode
        }
        set {
            if let playerVC = self.playerViewController {
                playerVC.view.layer.fillMode = newValue
            }
            self.playerLayer.fillMode = newValue
        }
    }

    // MARK: - object lifecycle

    override init(frame: CGRect) {
        super.init(frame: frame)
        playerBackgroundColor = UIColor.black
        playerFillMode = PlayerFillMode.resizeAspectFit.avFoundationType
        addPlayerViewController() // TODO: Make this an option
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        playerBackgroundColor = UIColor.black
        playerFillMode = PlayerFillMode.resizeAspectFit.avFoundationType
        addPlayerViewController() // TODO: Make this an option
    }

    private func addPlayerViewController() {
        playerViewController = AVPlayerViewController()
        if let playerVCView = playerViewController?.view {
            self.addSubview(playerVCView)
        }
    }

    deinit {
