From dc7b4200faea2f514415d9328462616d3c894d63 Mon Sep 17 00:00:00 2001 From: YangJH Date: Wed, 24 Jan 2024 00:19:10 +0900 Subject: [PATCH] refactor(ios): remove type assertion within setupPipController --- ios/Video/Features/RCTPictureInPicture.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 }