2018-03-01 15:38:38 -07:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
|
#import <SPTPersistentCache/SPTPersistentCache.h>
|
|
|
|
#import <SPTPersistentCache/SPTPersistentCacheOptions.h>
|
|
|
|
#import <CommonCrypto/CommonDigest.h>
|
|
|
|
|
2018-08-06 02:40:11 -06:00
|
|
|
typedef NS_ENUM(NSUInteger, RCTVideoCacheStatus) {
|
|
|
|
RCTVideoCacheStatusMissingFileExtension,
|
|
|
|
RCTVideoCacheStatusUnsupportedFileExtension,
|
|
|
|
RCTVideoCacheStatusNotAvailable,
|
|
|
|
RCTVideoCacheStatusAvailable
|
|
|
|
};
|
|
|
|
|
2018-03-01 15:38:38 -07:00
|
|
|
@class SPTPersistentCache;
|
|
|
|
@class SPTPersistentCacheOptions;
|
|
|
|
|
|
|
|
@interface RCTVideoCache : NSObject
|
|
|
|
{
|
|
|
|
SPTPersistentCache *videoCache;
|
|
|
|
NSString * _Nullable cachePath;
|
|
|
|
NSString * temporaryCachePath;
|
|
|
|
NSString * _Nullable cacheIdentifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property(nonatomic, strong) SPTPersistentCache * _Nullable videoCache;
|
|
|
|
@property(nonatomic, strong) NSString * cachePath;
|
|
|
|
@property(nonatomic, strong) NSString * cacheIdentifier;
|
|
|
|
@property(nonatomic, strong) NSString * temporaryCachePath;
|
|
|
|
|
|
|
|
+ (RCTVideoCache *)sharedInstance;
|
|
|
|
- (void)storeItem:(NSData *)data forUri:(NSString *)uri withCallback:(void(^)(BOOL))handler;
|
2018-08-06 02:40:11 -06:00
|
|
|
- (void)getItemForUri:(NSString *)url withCallback:(void(^)(RCTVideoCacheStatus, AVAsset * _Nullable)) handler;
|
2018-03-01 15:38:38 -07:00
|
|
|
- (NSURL *)createUniqueTemporaryFileUrl:(NSString * _Nonnull)url withExtension:(NSString * _Nonnull) extension;
|
|
|
|
- (AVURLAsset *)getItemFromTemporaryStorage:(NSString *)key;
|
|
|
|
- (BOOL)saveDataToTemporaryStorage:(NSData *)data key:(NSString *)key;
|
|
|
|
- (void) createTemporaryPath;
|
|
|
|
|
|
|
|
@end
|