ZFPlayerMediaControl.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. //
  2. // ZFPlayerMediaControl.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 <Foundation/Foundation.h>
  25. #import "ZFPlayerMediaPlayback.h"
  26. #import "ZFOrientationObserver.h"
  27. #import "ZFPlayerGestureControl.h"
  28. #import "ZFReachabilityManager.h"
  29. @class ZFPlayerController;
  30. NS_ASSUME_NONNULL_BEGIN
  31. @protocol ZFPlayerMediaControl <NSObject>
  32. @required
  33. /// Current playerController
  34. @property (nonatomic, weak) ZFPlayerController *player;
  35. @optional
  36. #pragma mark - Playback state
  37. /// When the player prepare to play the video.
  38. - (void)videoPlayer:(ZFPlayerController *)videoPlayer prepareToPlay:(NSURL *)assetURL;
  39. /// When th player playback state changed.
  40. - (void)videoPlayer:(ZFPlayerController *)videoPlayer playStateChanged:(ZFPlayerPlaybackState)state;
  41. /// When th player loading state changed.
  42. - (void)videoPlayer:(ZFPlayerController *)videoPlayer loadStateChanged:(ZFPlayerLoadState)state;
  43. #pragma mark - progress
  44. /**
  45. When the playback changed.
  46. @param videoPlayer the player.
  47. @param currentTime the current play time.
  48. @param totalTime the video total time.
  49. */
  50. - (void)videoPlayer:(ZFPlayerController *)videoPlayer
  51. currentTime:(NSTimeInterval)currentTime
  52. totalTime:(NSTimeInterval)totalTime;
  53. /**
  54. When buffer progress changed.
  55. */
  56. - (void)videoPlayer:(ZFPlayerController *)videoPlayer
  57. bufferTime:(NSTimeInterval)bufferTime;
  58. /**
  59. When you are dragging to change the video progress.
  60. */
  61. - (void)videoPlayer:(ZFPlayerController *)videoPlayer
  62. draggingTime:(NSTimeInterval)seekTime
  63. totalTime:(NSTimeInterval)totalTime;
  64. /**
  65. When play end.
  66. */
  67. - (void)videoPlayerPlayEnd:(ZFPlayerController *)videoPlayer;
  68. /**
  69. When play failed.
  70. */
  71. - (void)videoPlayerPlayFailed:(ZFPlayerController *)videoPlayer error:(id)error;
  72. #pragma mark - lock screen
  73. /**
  74. When set `videoPlayer.lockedScreen`.
  75. */
  76. - (void)lockedVideoPlayer:(ZFPlayerController *)videoPlayer lockedScreen:(BOOL)locked;
  77. #pragma mark - Screen rotation
  78. /**
  79. When the fullScreen maode will changed.
  80. */
  81. - (void)videoPlayer:(ZFPlayerController *)videoPlayer orientationWillChange:(ZFOrientationObserver *)observer;
  82. /**
  83. When the fullScreen maode did changed.
  84. */
  85. - (void)videoPlayer:(ZFPlayerController *)videoPlayer orientationDidChanged:(ZFOrientationObserver *)observer;
  86. #pragma mark - The network changed
  87. /**
  88. When the network changed
  89. */
  90. - (void)videoPlayer:(ZFPlayerController *)videoPlayer reachabilityChanged:(ZFReachabilityStatus)status;
  91. #pragma mark - The video size changed
  92. /**
  93. When the video size changed
  94. */
  95. - (void)videoPlayer:(ZFPlayerController *)videoPlayer presentationSizeChanged:(CGSize)size;
  96. #pragma mark - Gesture
  97. /**
  98. When the gesture condition
  99. */
  100. - (BOOL)gestureTriggerCondition:(ZFPlayerGestureControl *)gestureControl
  101. gestureType:(ZFPlayerGestureType)gestureType
  102. gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
  103. touch:(UITouch *)touch;
  104. /**
  105. When the gesture single tapped
  106. */
  107. - (void)gestureSingleTapped:(ZFPlayerGestureControl *)gestureControl;
  108. /**
  109. When the gesture double tapped
  110. */
  111. - (void)gestureDoubleTapped:(ZFPlayerGestureControl *)gestureControl;
  112. /**
  113. When the gesture begin panGesture
  114. */
  115. - (void)gestureBeganPan:(ZFPlayerGestureControl *)gestureControl
  116. panDirection:(ZFPanDirection)direction
  117. panLocation:(ZFPanLocation)location;
  118. /**
  119. When the gesture paning
  120. */
  121. - (void)gestureChangedPan:(ZFPlayerGestureControl *)gestureControl
  122. panDirection:(ZFPanDirection)direction
  123. panLocation:(ZFPanLocation)location
  124. withVelocity:(CGPoint)velocity;
  125. /**
  126. When the end panGesture
  127. */
  128. - (void)gestureEndedPan:(ZFPlayerGestureControl *)gestureControl
  129. panDirection:(ZFPanDirection)direction
  130. panLocation:(ZFPanLocation)location;
  131. /**
  132. When the pinchGesture changed
  133. */
  134. - (void)gesturePinched:(ZFPlayerGestureControl *)gestureControl
  135. scale:(float)scale;
  136. #pragma mark - scrollview
  137. /**
  138. When the player will appear in scrollView.
  139. */
  140. - (void)playerWillAppearInScrollView:(ZFPlayerController *)videoPlayer;
  141. /**
  142. When the player did appear in scrollView.
  143. */
  144. - (void)playerDidAppearInScrollView:(ZFPlayerController *)videoPlayer;
  145. /**
  146. When the player will disappear in scrollView.
  147. */
  148. - (void)playerWillDisappearInScrollView:(ZFPlayerController *)videoPlayer;
  149. /**
  150. When the player did disappear in scrollView.
  151. */
  152. - (void)playerDidDisappearInScrollView:(ZFPlayerController *)videoPlayer;
  153. /**
  154. When the player appearing in scrollView.
  155. */
  156. - (void)playerAppearingInScrollView:(ZFPlayerController *)videoPlayer playerApperaPercent:(CGFloat)playerApperaPercent;
  157. /**
  158. When the player disappearing in scrollView.
  159. */
  160. - (void)playerDisappearingInScrollView:(ZFPlayerController *)videoPlayer playerDisapperaPercent:(CGFloat)playerDisapperaPercent;
  161. /**
  162. When the small float view show.
  163. */
  164. - (void)videoPlayer:(ZFPlayerController *)videoPlayer floatViewShow:(BOOL)show;
  165. @end
  166. NS_ASSUME_NONNULL_END