TCBGMHelper.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // TCVideoEditBGMHelper.h
  3. // TXXiaoShiPinDemo
  4. //
  5. // Created by linkzhzhu on 2017/12/7.
  6. // Copyright © 2017年 tencent. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #define BGM_DEBUG 1
  10. #define BGMLog(...) {\
  11. if(BGM_DEBUG)NSLog(__VA_ARGS__);\
  12. }
  13. @interface TCBGMElement : NSObject
  14. @property NSString* name;
  15. @property NSString* netUrl;
  16. @property NSString* localUrl;
  17. @property NSString* author;
  18. @property NSString* title;
  19. @property NSNumber* duration;//float MicroSeconds
  20. @property NSNumber* isValid;
  21. @end
  22. @protocol TCBGMHelperListener <NSObject>
  23. /**
  24. 从json文件创建BGM列表,失败dict返回nil
  25. */
  26. @required
  27. -(void) onBGMListLoad:(NSDictionary*)dict;
  28. /**
  29. 每首BGM的进度回调
  30. */
  31. @optional
  32. -(void) onBGMDownloading:(TCBGMElement*)current percent:(float)percent;
  33. /**
  34. 下载结束回调,失败current返回nil
  35. */
  36. @optional
  37. -(void) onBGMDownloadDone:(TCBGMElement*)element;
  38. @end
  39. @interface TCBGMHelper : NSObject
  40. -(void) setDelegate:(nonnull id<TCBGMHelperListener>) delegate;
  41. -(void) initBGMListWithJsonFile:(NSString* _Nonnull)url;
  42. + (instancetype)sharedInstance;
  43. /**
  44. 下载BGM
  45. 新任务->新下载
  46. 当前正在下载->暂停下载
  47. 当前暂停->恢复下载
  48. 当前下载完成->重新下载
  49. @param name BGM名称
  50. */
  51. -(void) downloadBGM:(TCBGMElement*) name;
  52. //-(void) pauseAllTasks;
  53. //
  54. //-(void) resumeAllTasks;
  55. @end