BUVideoPrefetchManager.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // BUVideoPrefetchManager.h
  3. // BUAdSDK
  4. //
  5. // Created by 李盛 on 2018/9/20.
  6. // Copyright © 2018年 bytedance. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "BUPlayerSettingsProtocol.h"
  10. typedef void (^prefetchVideoCancelBlock)(NSInteger preloadSize);
  11. @interface BUVideoPrefetchManager : NSObject<BUPlayerSettingsProtocol>
  12. + (instancetype)sharedInstance;
  13. /// 预加载视频
  14. /// @param videoUrl 视频 URL
  15. /// @param storgeName 视频文件存储名称
  16. /// @param prefetchSize 预加载大小
  17. /// @param prefetchStartBlock 预加载开始回调
  18. /// @param prefetchFinshBlock 预加载结束回调
  19. - (void)prefetchWithVideoUrl:(NSURL *)videoUrl
  20. storgeName:(NSString *)storgeName
  21. prefetchSize:(NSUInteger)prefetchSize
  22. prefetchStartBlock:(void(^)(void))prefetchStartBlock
  23. prefetchFinshBlock:(void(^)(BOOL, NSInteger, NSError *, NSString *))prefetchFinshBlock
  24. prefetchCancelBlock:(prefetchVideoCancelBlock)prefetchCancelBlock;
  25. /// 判断url是否正在下载
  26. /// @param videoURL 视频 URL
  27. - (BOOL)prefetchUrlInQueue:(NSURL *)videoURL;
  28. /// 取消预加载,播放时应先取消预加载。
  29. /// @param videoURL 视频 URL
  30. - (void)cancelPrefetch:(NSURL *)videoURL;
  31. /// 查询视频预加载大小
  32. /// @param videoUrl 视频 URL
  33. - (NSInteger)queryPrefetchSizeWithVideoUrl:(NSURL *)videoUrl;
  34. @end