mirror of
https://github.com/zhigang1992/react-native-video-cache.git
synced 2026-01-12 16:42:21 +08:00
Use absolute file URL for cached video (#26)
This commit is contained in:
@@ -14,7 +14,17 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(convert:(NSString *)url)
|
||||
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
|
||||
@@ -29,7 +39,17 @@ RCT_EXPORT_METHOD(convertAsync:(NSString *)url
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user