VIResourceLoaderManager.h 982 B

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