DFPlayerRequestManager.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // DFPlayerRequestManager.h
  3. // DFPlayer
  4. //
  5. // Created by ihoudf on 2017/7/31.
  6. // Copyright © 2017年 ihoudf. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <Foundation/NSURLError.h>
  10. @protocol DFPlayerRequestDelegate <NSObject>
  11. /**
  12. 得到服务器响应
  13. @param statusCode 状态码
  14. */
  15. - (void)requestManagerDidReceiveResponseWithStatusCode:(NSInteger)statusCode;
  16. /**
  17. 从服务器接收到数据
  18. */
  19. - (void)requestManagerDidReceiveData;
  20. /**
  21. 缓存结果
  22. @param isCached 是否完成了缓存
  23. */
  24. - (void)requestManagerIsCached:(BOOL)isCached;
  25. /**
  26. 接收数据完成
  27. @param errorCode 错误码
  28. */
  29. - (void)requestManagerDidCompleteWithError:(NSInteger)errorCode;
  30. @end
  31. /**
  32. DFPlayer请求管理器
  33. */
  34. @interface DFPlayerRequestManager : NSObject
  35. + (instancetype)requestWithUrl:(NSURL *)url;
  36. - (instancetype)initWithUrl:(NSURL *)url;
  37. @property (nonatomic, weak) id<DFPlayerRequestDelegate> delegate;
  38. @property (nonatomic, assign) NSInteger requestOffset;//请求起始位置
  39. @property (nonatomic, assign) NSInteger fileLength;//文件长度
  40. @property (nonatomic, assign) NSInteger cacheLength;//缓冲长度
  41. @property (nonatomic, assign) BOOL cancel;//是否取消请求
  42. @property (nonatomic, assign) BOOL isHaveCache;//是否有缓存
  43. @property (nonatomic, assign) BOOL isObserveFileModifiedTime;//是否观察修改时间
  44. - (void)requestStart;
  45. @end