NIMAudioObject.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // NIMAudioObject.h
  3. // NIMLib
  4. //
  5. // Created by Netease.
  6. // Copyright (c) 2015年 Netease. All rights reserved.
  7. //
  8. #import "NIMMessageObjectProtocol.h"
  9. NS_ASSUME_NONNULL_BEGIN
  10. /**
  11. * 语音实例对象
  12. */
  13. @interface NIMAudioObject : NSObject<NIMMessageObject>
  14. /**
  15. * 语音对象初始化方法
  16. *
  17. * @param sourcePath 语音路径
  18. *
  19. * @return 语音实例对象
  20. */
  21. - (instancetype)initWithSourcePath:(NSString *)sourcePath;
  22. /**
  23. * 语音对象初始化方法
  24. *
  25. * @param data 语音数据
  26. * @param extension 语音数据文件后缀名
  27. *
  28. * @return 语音实例对象
  29. */
  30. - (instancetype)initWithData:(NSData *)data
  31. extension:(NSString *)extension;
  32. /**
  33. * 语音对象初始化方法
  34. *
  35. * @param sourcePath 语音路径
  36. * @param scene 场景类别
  37. *
  38. * @return 语音实例对象
  39. */
  40. - (instancetype)initWithSourcePath:(NSString *)sourcePath scene:(NSString *)scene;
  41. /**
  42. * 语音对象初始化方法
  43. *
  44. * @param data 语音数据
  45. * @param extension 语音数据文件后缀名
  46. * @param scene 场景类别
  47. *
  48. * @return 语音实例对象
  49. */
  50. - (instancetype)initWithData:(NSData *)data
  51. extension:(NSString *)extension
  52. scene:(NSString *)scene;
  53. /**
  54. * 设置上传的url,用于发送已经上传好的资源
  55. *
  56. * @param urlString 图片的地址
  57. *
  58. */
  59. - (void)setUploadURL:(NSString *)urlString;
  60. /**
  61. * 语音的本地路径
  62. */
  63. @property (nullable, nonatomic, copy, readonly) NSString *path;
  64. /**
  65. * 语音的远程路径
  66. */
  67. @property (nullable, nonatomic, copy, readonly) NSString *url;
  68. /**
  69. * 语音时长,毫秒为单位
  70. * @discussion SDK会根据传入文件信息自动解析出duration,但上层也可以自己设置这个值
  71. */
  72. @property (nonatomic, assign) NSInteger duration;
  73. /**
  74. * 音频MD5
  75. */
  76. @property (nullable,nonatomic, copy, readonly) NSString *md5;
  77. @end
  78. NS_ASSUME_NONNULL_END