diff --git a/ios/Video/Features/RCTPictureInPicture.swift b/ios/Video/Features/RCTPictureInPicture.swift index 0bf930f455..0ecc37b37b 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 } diff --git a/ios/Video/Features/RCTVideoTVUtils.swift b/ios/Video/Features/RCTVideoTVUtils.swift index 2edcf9c76f..8788d8318a 100644 --- a/ios/Video/Features/RCTVideoTVUtils.swift +++ b/ios/Video/Features/RCTVideoTVUtils.swift @@ -12,7 +12,7 @@ import Foundation var metadataGroups = [AVTimedMetadataGroup]() // Iterate over the defined chapters and build a timed metadata group object for each. - chapters.forEach { chapter in + for chapter in chapters { metadataGroups.append(makeTimedMetadataGroup(for: chapter)) }