refactor(ios): remove type assertion within setupPipController (#3493)

* refactor(ios): remove type assertion within setupPipController

* lint: apply swift lint
This commit is contained in:
YangJH 2024-01-24 15:54:58 +09:00 committed by GitHub
parent 7eeb1c530d
commit e63c7cbd30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -47,8 +47,10 @@ import React
} }
func setupPipController(_ playerLayer: AVPlayerLayer?) { func setupPipController(_ playerLayer: AVPlayerLayer?) {
guard let playerLayer else { return }
if !AVPictureInPictureController.isPictureInPictureSupported() { return }
// Create new controller passing reference to the AVPlayerLayer // Create new controller passing reference to the AVPlayerLayer
_pipController = AVPictureInPictureController(playerLayer: playerLayer!) _pipController = AVPictureInPictureController(playerLayer: playerLayer)
if #available(iOS 14.2, *) { if #available(iOS 14.2, *) {
_pipController?.canStartPictureInPictureAutomaticallyFromInline = true _pipController?.canStartPictureInPictureAutomaticallyFromInline = true
} }

View File

@ -12,7 +12,7 @@ import Foundation
var metadataGroups = [AVTimedMetadataGroup]() var metadataGroups = [AVTimedMetadataGroup]()
// Iterate over the defined chapters and build a timed metadata group object for each. // 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)) metadataGroups.append(makeTimedMetadataGroup(for: chapter))
} }