Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch committed Dec 26, 2023
1 parent 6211b4d commit 38bc2cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ios/VideoCaching/RCTVideoCachingHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Promises

class RCTVideoCachingHandler: NSObject, DVAssetLoaderDelegatesDelegate {
private var _videoCache: RCTVideoCache! = RCTVideoCache.sharedInstance()
var playerItemPrepareText: ((AVAsset?, NSDictionary?, String) -> AVPlayerItem)?
var playerItemPrepareText: ((AVAsset?, NSDictionary?, String) -> Promise<AVPlayerItem>)?

override init() {
super.init()
Expand All @@ -29,7 +29,7 @@ class RCTVideoCachingHandler: NSObject, DVAssetLoaderDelegatesDelegate {
func playerItemForSourceUsingCache(uri: String!, assetOptions options: NSDictionary!) -> Promise<AVPlayerItem?> {
let url = URL(string: uri)
return getItemForUri(uri)
.then { [weak self] (videoCacheStatus: RCTVideoCacheStatus, cachedAsset: AVAsset?) -> AVPlayerItem in
.then { [weak self] (videoCacheStatus: RCTVideoCacheStatus, cachedAsset: AVAsset?) -> Promise<AVPlayerItem> in
guard let self = self, let playerItemPrepareText = self.playerItemPrepareText else { throw NSError(domain: "", code: 0, userInfo: nil) }
switch videoCacheStatus {
case .missingFileExtension:
Expand Down Expand Up @@ -76,6 +76,9 @@ class RCTVideoCachingHandler: NSObject, DVAssetLoaderDelegatesDelegate {
*/

return AVPlayerItem(asset: asset)
}.then { playerItem -> AVPlayerItem? in
guard let playerItem = playerItem else { throw NSError(domain: "", code: 0, userInfo: nil) }
return playerItem
}
}

Expand Down

0 comments on commit 38bc2cd

Please sign in to comment.