diff --git a/ios/Video/Features/RCTPictureInPicture.swift b/ios/Video/Features/RCTPictureInPicture.swift index 0bf930f455..171200625a 100644 --- a/ios/Video/Features/RCTPictureInPicture.swift +++ b/ios/Video/Features/RCTPictureInPicture.swift @@ -47,8 +47,10 @@ import React } func setupPipController(_ playerLayer: AVPlayerLayer?) { + guard let playerLayer else { return } + if (!AVPictureInPictureController.isPictureInPictureSupported()) { return } // Create new controller passing reference to the AVPlayerLayer - _pipController = AVPictureInPictureController(playerLayer: playerLayer!) + _pipController = AVPictureInPictureController(playerLayer: playerLayer) if #available(iOS 14.2, *) { _pipController?.canStartPictureInPictureAutomaticallyFromInline = true }