ZFPortraitControlView.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // ZFPortraitControlView.h
  3. // ZFPlayer
  4. //
  5. // Copyright (c) 2016年 任子丰 ( http://github.com/renzifeng )
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. #import <UIKit/UIKit.h>
  25. #import "ZFSliderView.h"
  26. #if __has_include(<ZFPlayer/ZFPlayerController.h>)
  27. #import <ZFPlayer/ZFPlayerController.h>
  28. #else
  29. #import "ZFPlayerController.h"
  30. #endif
  31. #define DCStatusBarH ([UIApplication sharedApplication].statusBarFrame.size.height)
  32. NS_ASSUME_NONNULL_BEGIN
  33. @interface ZFPortraitControlView : UIView
  34. /// 底部工具栏
  35. @property (nonatomic, strong, readonly) UIView *bottomToolView;
  36. /// 顶部工具栏
  37. @property (nonatomic, strong, readonly) UIView *topToolView;
  38. /// 播放或暂停按钮
  39. @property (nonatomic, strong, readonly) UIButton *backBtn;
  40. /// 标题
  41. @property (nonatomic, strong, readonly) UILabel *titleLabel;
  42. /// 播放或暂停按钮
  43. @property (nonatomic, strong, readonly) UIButton *playOrPauseBtn;
  44. /// 播放的当前时间
  45. @property (nonatomic, strong, readonly) UILabel *currentTimeLabel;
  46. /// 滑杆
  47. @property (nonatomic, strong, readonly) ZFSliderView *slider;
  48. /// 视频总时间
  49. @property (nonatomic, strong, readonly) UILabel *totalTimeLabel;
  50. /// 全屏按钮
  51. @property (nonatomic, strong) UIButton *fullScreenBtn;
  52. /// 播放器
  53. @property (nonatomic, weak) ZFPlayerController *player;
  54. /// slider滑动中
  55. @property (nonatomic, copy, nullable) void(^sliderValueChanging)(CGFloat value,BOOL forward);
  56. /// slider滑动结束
  57. @property (nonatomic, copy, nullable) void(^sliderValueChanged)(CGFloat value);
  58. /// 如果是暂停状态,seek完是否播放,默认YES
  59. @property (nonatomic, assign) BOOL seekToPlay;
  60. /// 全屏模式
  61. @property (nonatomic, assign) ZFFullScreenMode fullScreenMode;
  62. /// 重置控制层
  63. - (void)resetControlView;
  64. /// 显示控制层
  65. - (void)showControlView;
  66. /// 隐藏控制层
  67. - (void)hideControlView;
  68. /// 设置播放时间
  69. - (void)videoPlayer:(ZFPlayerController *)videoPlayer currentTime:(NSTimeInterval)currentTime totalTime:(NSTimeInterval)totalTime;
  70. /// 设置缓冲时间
  71. - (void)videoPlayer:(ZFPlayerController *)videoPlayer bufferTime:(NSTimeInterval)bufferTime;
  72. /// 是否响应该手势
  73. - (BOOL)shouldResponseGestureWithPoint:(CGPoint)point withGestureType:(ZFPlayerGestureType)type touch:(nonnull UITouch *)touch;
  74. /// 标题和全屏模式
  75. - (void)showTitle:(NSString *_Nullable)title fullScreenMode:(ZFFullScreenMode)fullScreenMode;
  76. /// 根据当前播放状态取反
  77. - (void)playOrPause;
  78. /// 播放按钮状态
  79. - (void)playBtnSelectedState:(BOOL)selected;
  80. /// 调节播放进度slider和当前时间更新
  81. - (void)sliderValueChanged:(CGFloat)value currentTimeString:(NSString *)timeString;
  82. /// 滑杆结束滑动
  83. - (void)sliderChangeEnded;
  84. @end
  85. NS_ASSUME_NONNULL_END