DFPlayerTool.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // DFPlayerTool.h
  3. // DFPlayer
  4. //
  5. // Created by ihoudf on 2017/7/30.
  6. // Copyright © 2017年 ihoudf. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. static NSString * DFPlayerNotificationSeekEnd = @"DFPlayerNotificationSeekEnd";
  12. #define DFPlayerWeakSelf __weak __typeof(&*self) wSelf = self;
  13. #define DFPlayerStrongSelf __strong __typeof(&*self) sSelf = wSelf;
  14. #define DFPlayerHighGlobalQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)
  15. #define DFPlayerDefaultGlobalQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
  16. // 网络状态
  17. typedef NS_ENUM(NSInteger, DFPlayerNetworkStatus) {
  18. DFPlayerNetworkStatusUnknown = -1, //未知
  19. DFPlayerNetworkStatusNotReachable = 0, //无网络链接
  20. DFPlayerNetworkStatusReachableViaWWAN = 1, //2G/3G/4G
  21. DFPlayerNetworkStatusReachableViaWiFi = 2 //WIFI
  22. };
  23. /**
  24. DFPlayer工具类
  25. */
  26. @interface DFPlayerTool : NSObject
  27. // 链接
  28. + (NSURL *)customURL:(NSURL *)URL;
  29. + (NSURL *)originalURL:(NSURL *)URL;
  30. // 是否是本地音频
  31. + (BOOL)isLocalAudio:(NSURL *)URL;
  32. // 是否是NSURL类型
  33. + (BOOL)isNSURL:(NSURL *)URL;
  34. // 网络
  35. + (void)startMonitoringNetworkStatus:(void (^)(DFPlayerNetworkStatus networkStatus))block;
  36. + (void)stopMonitoringNetwork;
  37. + (DFPlayerNetworkStatus)networkStatus;
  38. @end
  39. @interface NSString (DFPlayerNSStringExtensions)
  40. // 字符串去空字符
  41. - (NSString *)df_removeEmpty;
  42. // 判断是否为空
  43. - (BOOL)df_isEmpty;
  44. // 是否包含字母
  45. - (BOOL)df_isContainLetter;
  46. @end
  47. @interface UIButton (DFPlayerUIButtonExtensions)
  48. @property(copy, nonatomic) void(^ _Nullable handleButtonActionBlock)(UIButton * _Nullable sender);
  49. @end
  50. NS_ASSUME_NONNULL_END