Skip to content

Commit

Permalink
Use absolute file URL for cached video (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
luckypal committed Jun 23, 2022
1 parent 33905f4 commit a2e6fcb
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions ios/VideoCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ @implementation VideoCache
return url;
}
}
return [KTVHTTPCache proxyURLWithOriginalURL:[NSURL URLWithString:url]].absoluteString;
NSURL* videoUrl = [NSURL URLWithString:url];
@try {
NSURL *completedCacheFileURL = [KTVHTTPCache cacheCompleteFileURLWithURL:videoUrl];
if (completedCacheFileURL != nil) {
return completedCacheFileURL.absoluteString;
}
}
@catch (NSException *exception) {
}

return [KTVHTTPCache proxyURLWithOriginalURL:videoUrl].absoluteString;
}

RCT_EXPORT_METHOD(convertAsync:(NSString *)url
Expand All @@ -29,7 +39,17 @@ @implementation VideoCache
return;
}
}
resolve([KTVHTTPCache proxyURLWithOriginalURL:[NSURL URLWithString:url]].absoluteString);
NSURL* videoUrl = [NSURL URLWithString:url];
@try {
NSURL *completedCacheFileURL = [KTVHTTPCache cacheCompleteFileURLWithURL:videoUrl];
if (completedCacheFileURL != nil) {
resolve(completedCacheFileURL.absoluteString);
return;
}
}
@catch (NSException *exception) {
}
resolve([KTVHTTPCache proxyURLWithOriginalURL:videoUrl].absoluteString);
}

@end

0 comments on commit a2e6fcb

Please sign in to comment.