YMRecordSoundView.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // YMRecordSoundView.h
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/2/25.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. /// 录制音频状态
  11. typedef NS_ENUM(NSUInteger,YMRecordSoundStatusType) {
  12. YMRecordSoundStatusTypeNone = 0, /// 未开始
  13. YMRecordSoundStatusTypeStart, /// 已开始
  14. YMRecordSoundStatusTypeFinish, /// 已完成
  15. YMRecordSoundStatusTypePlay, /// 播放
  16. YMRecordSoundStatusTypeSubmit, /// 提交
  17. };
  18. /// 录制音频导出类型
  19. typedef NS_ENUM(NSUInteger,YMRecordSoundExportType) {
  20. YMRecordSoundExportTypePM3 = 0, /// mp3
  21. YMRecordSoundExportTypeAAC, /// aac
  22. };
  23. typedef void(^RecordSoundExportUrlBlock)(NSURL * _Nonnull voiceUrl, NSInteger voiceDuration);
  24. @interface YMRecordSoundView : UIView
  25. - (instancetype)initWithIsNeedSubmitButton:(BOOL)isNeedSubmitButton OperationSize:(CGSize)operationSize;
  26. /// 录制声音导出路径回调
  27. @property (nonatomic, copy) RecordSoundExportUrlBlock exportUrlBlock;
  28. /// 最少时长
  29. @property (nonatomic, assign) NSInteger minDuration;
  30. /// 最大时长
  31. @property (nonatomic, assign) NSInteger maxDuration;
  32. /// 重录背景色
  33. @property (nonatomic, strong) UIColor *rerecordBgColor;
  34. /// 提交背景色
  35. @property (nonatomic, strong) UIColor *submitBgColor;
  36. /// 重录标题颜色
  37. @property (nonatomic, strong) UIColor *rerecordTitleColor;
  38. /// 提交标题颜色
  39. @property (nonatomic, strong) UIColor *submitTitleColor;
  40. /// 重录字体样式大小
  41. @property (nonatomic, strong) UIFont *rerecordFont;
  42. /// 提交字体样式大小
  43. @property (nonatomic, strong) UIFont *submitFont;
  44. /// 重录标题
  45. @property (nonatomic, copy) NSString *rerecordTitle;
  46. /// 提交标题
  47. @property (nonatomic, copy) NSString *submitTitle;
  48. /// 重录圆角大小
  49. @property (nonatomic, assign) CGFloat rerecordRadius;
  50. /// 提交圆角大小
  51. @property (nonatomic, assign) CGFloat submitRadius;
  52. /// 重录边框色
  53. @property (nonatomic, assign) UIColor *rerecordBorderColor;
  54. /// 提交边框色
  55. @property (nonatomic, assign) UIColor *submitBorderColor;
  56. /// 重录边框宽度大小
  57. @property (nonatomic, assign) CGFloat rerecordBorderWidth;
  58. /// 提交边框宽度大小
  59. @property (nonatomic, assign) CGFloat submitBorderWidth;
  60. /// 重录图片
  61. @property (nonatomic, strong) NSString *rerecordImageStr;
  62. /// 提交图片
  63. @property (nonatomic, strong) NSString *submitImageStr;
  64. /// 需要转出的文件格式
  65. @property (nonatomic, assign) YMRecordSoundExportType exportType;
  66. /// 本地url路径
  67. - (NSURL *)recordAudioUrl;
  68. /// 获取提交声音url
  69. - (NSURL *)getSubmitSoundUrl;
  70. /// 停止录制
  71. - (void)stopRecord;
  72. @end
  73. NS_ASSUME_NONNULL_END