TUIVoiceMessageCellData.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Created by Tencent on 2023/06/09.
  2. // Copyright © 2023 Tencent. All rights reserved.
  3. #import <TIMCommon/TUIBubbleMessageCellData.h>
  4. #import <TIMCommon/TUIMessageCellData.h>
  5. NS_ASSUME_NONNULL_BEGIN
  6. typedef NS_ENUM(NSUInteger, TUIVoiceAudioPlaybackStyle) {
  7. TUIVoiceAudioPlaybackStyleLoudspeaker = 1,
  8. TUIVoiceAudioPlaybackStyleHandset = 2,
  9. };
  10. @interface TUIVoiceMessageCellData : TUIBubbleMessageCellData
  11. @property(nonatomic, strong) NSString *path;
  12. @property(nonatomic, strong) NSString *uuid;
  13. @property(nonatomic, assign) int duration;
  14. @property(nonatomic, assign) int length;
  15. @property(nonatomic, assign) BOOL isDownloading;
  16. @property(nonatomic, assign) BOOL isPlaying;
  17. @property(nonatomic, assign) CGFloat voiceHeight;
  18. @property(nonatomic, assign) NSTimeInterval currentTime;
  19. /**
  20. *
  21. * Play animation image
  22. * An animation used to implement the "sonic image" fade of the speech as it plays.
  23. * If you want to customize the implementation of other kinds of animation icons, you can refer to the implementation of voiceAnimationIamges here.
  24. */
  25. @property NSArray<UIImage *> *voiceAnimationImages;
  26. /**
  27. *
  28. * voice icon
  29. * Animated icon to show when the speech is not playing.
  30. */
  31. @property UIImage *voiceImage;
  32. @property(nonatomic, assign) CGFloat voiceTop;
  33. /**
  34. *
  35. * Top margin of voice message
  36. * This value is used to determine the position of the bubble, which is convenient for UI layout of the content in the bubble.
  37. * If the value is abnormal or set arbitrarily, UI errors such as message position dislocation will occur.
  38. */
  39. @property(nonatomic, class) CGFloat incommingVoiceTop;
  40. @property(nonatomic, class) CGFloat outgoingVoiceTop;
  41. - (void)stopVoiceMessage;
  42. /**
  43. * Begin to play voice. It will download the voice file from server if it not exists in local.
  44. */
  45. - (void)playVoiceMessage;
  46. @property(nonatomic, copy) void (^audioPlayerDidFinishPlayingBlock)(void);
  47. //The style of audio playback.
  48. + (TUIVoiceAudioPlaybackStyle)getAudioplaybackStyle;
  49. + (void)changeAudioPlaybackStyle;
  50. @end
  51. NS_ASSUME_NONNULL_END