DFPlayerUIManager.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. //
  2. // DFPlayerUIManager.h
  3. // DFPlayer
  4. //
  5. // Created by ihoudf on 2017/7/20.
  6. // Copyright © 2017年 ihoudf. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. /**
  12. DFPlayer控制管理器
  13. */
  14. @interface DFPlayerUIManager : NSObject
  15. /**
  16. 单利
  17. */
  18. + (DFPlayerUIManager *)sharedManager;
  19. /**
  20. 停止所有进度类控件的刷新
  21. */
  22. - (void)df_stopUpdate;
  23. /**
  24. 恢复所有进度类控件的刷新
  25. */
  26. - (void)df_resumeUpdate;
  27. /**
  28. 播放暂停按钮
  29. @param frame 按钮frame
  30. @param playImage 播放状态时显示的image
  31. @param pauseImage 暂停播放时显示的image
  32. @param superView 按钮父视图
  33. @param block 按钮action
  34. @return 播放暂停按钮
  35. */
  36. - (UIButton *)df_playPauseBtnWithFrame:(CGRect)frame
  37. playImage:(UIImage *)playImage
  38. pauseImage:(UIImage *)pauseImage
  39. superView:(UIView *)superView
  40. block:(nullable void (^)(void))block;
  41. /**
  42. 上一首按钮
  43. @param frame 按钮frame
  44. @param image 按钮image
  45. @param superView 按钮父视图
  46. @param block 按钮action
  47. @return 上一首按钮
  48. */
  49. - (UIButton *)df_lastBtnWithFrame:(CGRect)frame
  50. image:(UIImage *)image
  51. superView:(UIView *)superView
  52. block:(nullable void (^)(void))block;
  53. /**
  54. 下一首按钮
  55. @param frame 按钮frame
  56. @param image 按钮image
  57. @param superView 按钮父视图
  58. @param block 按钮action
  59. @return 下一首按钮
  60. */
  61. - (UIButton *)df_nextBtnWithFrame:(CGRect)frame
  62. image:(UIImage *)image
  63. superView:(UIView *)superView
  64. block:(nullable void (^)(void))block;
  65. /**
  66. 播放模式按钮(DFPlayerMode不是DFPlayerModeOnlyOnce时有效。)
  67. @param frame 按钮frame
  68. @param singleImage 按钮singleImage
  69. @param circleImage 按钮circleImage
  70. @param shuffleImage 按钮shuffleImage
  71. @param superView 按钮父视图
  72. @param block 按钮action,若无其他操作需求,传nil即可
  73. @return 播放模式按钮
  74. */
  75. - (UIButton *)df_typeBtnWithFrame:(CGRect)frame
  76. singleImage:(UIImage *)singleImage
  77. circleImage:(UIImage *)circleImage
  78. shuffleImage:(UIImage *)shuffleImage
  79. superView:(UIView *)superView
  80. block:(nullable void (^)(void))block;
  81. /**
  82. 缓冲条
  83. @param frame frame
  84. @param trackTintColor 未缓冲部分进度条颜色
  85. @param progressTintColor 已缓冲部分进度条颜色
  86. @param superView 进度条父视图
  87. @return 进度条
  88. */
  89. - (UIProgressView *)df_bufferViewWithFrame:(CGRect)frame
  90. trackTintColor:(UIColor *)trackTintColor
  91. progressTintColor:(UIColor *)progressTintColor
  92. superView:(UIView *)superView;
  93. /**
  94. 播放进度条
  95. @param frame frame
  96. @param minimumTrackTintColor 滑块左边滑动条的颜色
  97. @param maximumTrackTintColor 滑块右边滑动条的颜色
  98. @param trackHeight 滑动条的高度(长度采用frame的width)
  99. @param thumbImage 滑块图片
  100. @param superView 进度条父视图
  101. @return 进度条
  102. */
  103. - (UISlider *)df_sliderWithFrame:(CGRect)frame
  104. minimumTrackTintColor:(UIColor *)minimumTrackTintColor
  105. maximumTrackTintColor:(UIColor *)maximumTrackTintColor
  106. trackHeight:(CGFloat)trackHeight
  107. thumbImage:(UIImage *)thumbImage
  108. superView:(UIView *)superView;
  109. /**
  110. 音频当前时间label
  111. @param frame frame
  112. @param textColor textColor
  113. @param textAlignment textAlignment
  114. @param font font
  115. @param superView label父视图
  116. @return label
  117. */
  118. - (UILabel *)df_currentTimeLabelWithFrame:(CGRect)frame
  119. textColor:(UIColor *)textColor
  120. textAlignment:(NSTextAlignment)textAlignment
  121. font:(UIFont *)font
  122. superView:(UIView *)superView;
  123. /**
  124. 音频总时长label
  125. @param frame frame
  126. @param textColor textColor
  127. @param textAlignment textAlignment
  128. @param font font
  129. @param superView label父视图
  130. @return label
  131. */
  132. - (UILabel *)df_totalTimeLabelWithFrame:(CGRect)frame
  133. textColor:(UIColor *)textColor
  134. textAlignment:(NSTextAlignment)textAlignment
  135. font:(UIFont *)font
  136. superView:(UIView *)superView;
  137. /**
  138. 歌词tableview
  139. ①采用lrc标准格式编写,即"[00:00.00]歌词" 或 "[00:00]歌词" 或 "[00:00:00]歌词"
  140. ②根据lrc歌词软件开发标准,凡具有“[*:*]”形式的都应认为是标签(注意:其中的冒号并非全角字符“:”)。凡是标签都不应显示。
  141. ③支持单句歌词多个时间的格式,如“[00:10.00][00:50.00][00:70.00]歌词”
  142. ④lrc歌词文件单行只有时间标签,没有歌词内容的,将被认作为上一个相邻时间内歌词的结束时间,并不做空行显示处理。比如
  143. [00:11.11]歌词
  144. [00:22.22] (22秒22毫米,该时间下无歌词显示,将被认作为上一个相邻时间歌词的演唱结束时间。此处的相邻不是位置的相邻,而是时间大小的相邻)
  145. ⑤如果歌词中需要空行,DFPlayer默认时间标签后的“####”是空行标志,如“[00:11.11]####”,DFPlayer将在解析到歌词为####时做空行显示
  146. 详情查看demo中”许嵩(Vae)-有何不可.lrc“文件
  147. ⑥DFPlayer认为每个时间标签都是一个单元格。只不过时间标签后无歌词时,DFPlayer将该单元格隐藏。
  148. ⑦DFPlayer不对单句歌词做换行处理,所以单行歌词长度尽量不要超过tableview的宽度,当超出时,DFPlayer用末尾省略号处理。
  149. @param frame tableview frame
  150. @param cellRowHeight tableview 单行rowHeight
  151. @param cellBackgroundColor cell背景色
  152. @param currentLineLrcForegroundTextColor 当前行歌词文字前景色(此属性不为nil时,采用卡拉OK模式显示)
  153. @param currentLineLrcBackgroundTextColor 当前行歌词文字背景色
  154. @param otherLineLrcBackgroundTextColor 其他行歌词文字颜色
  155. @param currentLineLrcFont 当前行歌词字体
  156. @param otherLineLrcFont 其他行歌词字体
  157. @param superView 父视图
  158. @param block 返回当前正在播放的歌词
  159. @return 歌词tableView
  160. */
  161. - (UITableView *)df_lyricTableViewWithFrame:(CGRect)frame
  162. cellRowHeight:(CGFloat)cellRowHeight
  163. cellBackgroundColor:(UIColor *)cellBackgroundColor
  164. currentLineLrcForegroundTextColor:(nullable UIColor *)currentLineLrcForegroundTextColor
  165. currentLineLrcBackgroundTextColor:(UIColor *)currentLineLrcBackgroundTextColor
  166. otherLineLrcBackgroundTextColor:(UIColor *)otherLineLrcBackgroundTextColor
  167. currentLineLrcFont:(UIFont *)currentLineLrcFont
  168. otherLineLrcFont:(UIFont *)otherLineLrcFont
  169. superView:(UIView *)superView
  170. block:(nullable void (^)(NSString * onPlayingLyrics))block;
  171. - (void)RefreshTotalTimeLabelFun;
  172. /**释放播放器UI*/
  173. - (void)dfUI_deallocPlayer;
  174. @end
  175. NS_ASSUME_NONNULL_END