1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// VIResourceLoaderManager.h
// VIMediaCacheDemo
//
// Created by Vito on 4/21/16.
// Copyright © 2016 Vito. All rights reserved.
//
#import <Foundation/Foundation.h>
@import AVFoundation;
@protocol VIResourceLoaderManagerDelegate;
@interface VIResourceLoaderManager : NSObject <AVAssetResourceLoaderDelegate>
@property (nonatomic, weak) id<VIResourceLoaderManagerDelegate> delegate;
/**
Normally you no need to call this method to clean cache. Cache cleaned after AVPlayer delloc.
If you have a singleton AVPlayer then you need call this method to clean cache at suitable time.
*/
- (void)cleanCache;
@end
@protocol VIResourceLoaderManagerDelegate <NSObject>
- (void)resourceLoaderManagerLoadURL:(NSURL *)url didFailWithError:(NSError *)error;
@end
@interface VIResourceLoaderManager (Convenient)
+ (NSURL *)assetURLWithURL:(NSURL *)url;
- (AVPlayerItem *)playerItemWithURL:(NSURL *)url;
@end