JMSGMediaAbstractContent.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * | | | | \ \ / / | | | | / _______|
  3. * | |____| | \ \/ / | |____| | / /
  4. * | |____| | \ / | |____| | | | _____
  5. * | | | | / \ | | | | | | |____ |
  6. * | | | | / /\ \ | | | | \ \______| |
  7. * | | | | /_/ \_\ | | | | \_________|
  8. *
  9. * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved.
  10. */
  11. #import <Foundation/Foundation.h>
  12. #import <JMessage/JMSGAbstractContent.h>
  13. @class JMSGData;
  14. /*!
  15. * 媒体内容类型的抽象父类
  16. *
  17. * 所有的媒体文件内容, 如 VoiceContent,ImageContent,
  18. * 都有媒体文件的处理逻辑, 比如上传与下载, 这些逻辑都放在这个类里统一处理.
  19. *
  20. * 这个类一般对外不可见.
  21. */
  22. @interface JMSGMediaAbstractContent : JMSGAbstractContent <NSCopying>
  23. JMSG_ASSUME_NONNULL_BEGIN
  24. /*!
  25. * @abstract 媒体文件ID
  26. *
  27. * @discussion 这是 JMessage 内部用于表示资源文件的ID,使用该ID 可以定位到网络上的资源。
  28. *
  29. * 收到消息时,通过此ID 可以下载到资源;发出消息时,文件上传成功会生成此ID。
  30. *
  31. * 注意: 不支持外部设置媒体ID,也不支持把此字段设置为 URL 来下载到资源文件。
  32. */
  33. @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE mediaID;
  34. /*! @abstract 媒体格式*/
  35. @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE format;
  36. /*! @abstract 媒体文件大小 */
  37. @property(nonatomic, strong, readonly) NSNumber *fSize;
  38. /*!
  39. * @abstract 上传资源文件progress绑定(用来监听上传progress回调)
  40. * @discussion 如果需要监听这条消息的上传文件进度, 则需要赋值这个 block 为你你自己的实现
  41. */
  42. @property(nonatomic, copy)JMSGMediaProgressHandler JMSG_NULLABLE uploadHandler;
  43. /*!
  44. * @abstract 获取原文件的本地路径
  45. *
  46. * @discussion 此属性是通过懒加载的方式获取,必须在下载完成之后此属性值才有意义
  47. */
  48. @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE originMediaLocalPath;
  49. // 不支持使用的初始化方法
  50. - (nullable instancetype)init NS_UNAVAILABLE;
  51. JMSG_ASSUME_NONNULL_END
  52. @end