TJRecorderTool.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // TJRecorderTool.h
  3. // TJAudioRecorderAndPlayer
  4. //
  5. // Created by TanJian on 17/5/19.
  6. // Copyright © 2017年 Joshpell. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import <AVFoundation/AVFoundation.h>
  11. @class TJRecorderTool ;
  12. typedef TJRecorderTool *(^configerOrAction)(void);
  13. typedef TJRecorderTool *(^configureURL)(NSString *url);
  14. typedef void (^configerTimeFeedback)(NSString *totalTime,NSString *currentTime);
  15. typedef void (^configerVolume)(CGFloat colume);
  16. typedef NSData *(^configerRecorderData)(void);
  17. typedef void(^playerFinished)(void);
  18. @interface TJRecorderTool : NSObject
  19. /*
  20. * 录音工具单例
  21. */
  22. + (instancetype)sharedInstance;
  23. /*
  24. * 录音前需要做的配置
  25. */
  26. @property (nonatomic, copy, readonly) configerOrAction configureRecorder;
  27. /*
  28. * 开始录音
  29. */
  30. @property (nonatomic, copy, readonly) configerOrAction startRecord;
  31. /*
  32. * 继续录音
  33. */
  34. @property (nonatomic, copy, readonly) configerOrAction continueRecord;
  35. /*
  36. * 结束录音
  37. */
  38. @property (nonatomic, copy, readonly) configerOrAction stopRecorder;
  39. /*
  40. * 暂停录音
  41. */
  42. @property (nonatomic, copy, readonly) configerOrAction pauseRecord;
  43. /*
  44. * 本地录音播放
  45. */
  46. @property (nonatomic, copy, readonly) configerOrAction playRecorderLocal;
  47. /*
  48. * 本地录音播放暂停
  49. */
  50. @property (nonatomic, copy, readonly) configerOrAction pauseRecorderPlayLocal;
  51. /*
  52. * 本地录音播放继续
  53. */
  54. @property (nonatomic, copy, readonly) configerOrAction continueRecorderPlayLocal;
  55. /*
  56. * 本地录音停止
  57. */
  58. @property (nonatomic, copy, readonly) configerOrAction stopRecorderPlayLocal;
  59. /*
  60. * 播放网络音频前需要做的配置
  61. */
  62. @property (nonatomic, copy, readonly) configerOrAction configureNetwork;
  63. /*
  64. * 播放网络音频前的加载
  65. */
  66. @property (nonatomic, copy, readonly) configureURL downloadNetworkaAudio;
  67. /*
  68. * 播放网络音频
  69. */
  70. @property (nonatomic, copy, readonly) configerOrAction playNetwork;
  71. /*
  72. * 暂停播放网络音频
  73. */
  74. @property (nonatomic, copy, readonly) configerOrAction pauseNetwork;
  75. /*
  76. * 停止播放网络音频
  77. */
  78. @property (nonatomic, copy, readonly) configerOrAction stopNetwork;
  79. #pragma mark block操作
  80. /*
  81. * 播放时间回调Block
  82. */
  83. @property (nonatomic, copy) configerTimeFeedback timeObserverBlock;
  84. /*
  85. * 录音时长回调Block
  86. */
  87. @property (nonatomic, copy) configerTimeFeedback recordTimeObserverBlock;
  88. /*
  89. * 音量监听回调Block
  90. */
  91. @property (nonatomic, copy) configerVolume volumeObserverBlock;
  92. /*
  93. * 获取最后一次录音的数据
  94. */
  95. @property (nonatomic, copy) configerRecorderData getRecorderDataBlock;
  96. /*
  97. * 播放完成回调
  98. */
  99. @property (nonatomic, copy) playerFinished playerFinished;
  100. #pragma mark 外部调用方法
  101. -(NSString *)getRecorderPath;
  102. -(BOOL)isRecording;
  103. -(CGFloat)getLocalRecordTime;//获取本地播放的录音文件时长
  104. @end