123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- //
- // ZFPlayerMediaControl.h
- // ZFPlayer
- //
- // Copyright (c) 2016年 任子丰 ( http://github.com/renzifeng )
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy
- // of this software and associated documentation files (the "Software"), to deal
- // in the Software without restriction, including without limitation the rights
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- // copies of the Software, and to permit persons to whom the Software is
- // furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in
- // all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- // THE SOFTWARE.
- #import <Foundation/Foundation.h>
- #import "ZFPlayerMediaPlayback.h"
- #import "ZFOrientationObserver.h"
- #import "ZFPlayerGestureControl.h"
- #import "ZFReachabilityManager.h"
- @class ZFPlayerController;
- NS_ASSUME_NONNULL_BEGIN
- @protocol ZFPlayerMediaControl <NSObject>
- @required
- /// Current playerController
- @property (nonatomic, weak) ZFPlayerController *player;
- @optional
- #pragma mark - Playback state
- /// When the player prepare to play the video.
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer prepareToPlay:(NSURL *)assetURL;
- /// When th player playback state changed.
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer playStateChanged:(ZFPlayerPlaybackState)state;
- /// When th player loading state changed.
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer loadStateChanged:(ZFPlayerLoadState)state;
- #pragma mark - progress
- /**
- When the playback changed.
-
- @param videoPlayer the player.
- @param currentTime the current play time.
- @param totalTime the video total time.
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer
- currentTime:(NSTimeInterval)currentTime
- totalTime:(NSTimeInterval)totalTime;
- /**
- When buffer progress changed.
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer
- bufferTime:(NSTimeInterval)bufferTime;
- /**
- When you are dragging to change the video progress.
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer
- draggingTime:(NSTimeInterval)seekTime
- totalTime:(NSTimeInterval)totalTime;
- /**
- When play end.
- */
- - (void)videoPlayerPlayEnd:(ZFPlayerController *)videoPlayer;
- /**
- When play failed.
- */
- - (void)videoPlayerPlayFailed:(ZFPlayerController *)videoPlayer error:(id)error;
- #pragma mark - lock screen
- /**
- When set `videoPlayer.lockedScreen`.
- */
- - (void)lockedVideoPlayer:(ZFPlayerController *)videoPlayer lockedScreen:(BOOL)locked;
- #pragma mark - Screen rotation
- /**
- When the fullScreen maode will changed.
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer orientationWillChange:(ZFOrientationObserver *)observer;
- /**
- When the fullScreen maode did changed.
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer orientationDidChanged:(ZFOrientationObserver *)observer;
- #pragma mark - The network changed
- /**
- When the network changed
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer reachabilityChanged:(ZFReachabilityStatus)status;
- #pragma mark - The video size changed
- /**
- When the video size changed
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer presentationSizeChanged:(CGSize)size;
- #pragma mark - Gesture
- /**
- When the gesture condition
- */
- - (BOOL)gestureTriggerCondition:(ZFPlayerGestureControl *)gestureControl
- gestureType:(ZFPlayerGestureType)gestureType
- gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
- touch:(UITouch *)touch;
- /**
- When the gesture single tapped
- */
- - (void)gestureSingleTapped:(ZFPlayerGestureControl *)gestureControl;
- /**
- When the gesture double tapped
- */
- - (void)gestureDoubleTapped:(ZFPlayerGestureControl *)gestureControl;
- /**
- When the gesture begin panGesture
- */
- - (void)gestureBeganPan:(ZFPlayerGestureControl *)gestureControl
- panDirection:(ZFPanDirection)direction
- panLocation:(ZFPanLocation)location;
- /**
- When the gesture paning
- */
- - (void)gestureChangedPan:(ZFPlayerGestureControl *)gestureControl
- panDirection:(ZFPanDirection)direction
- panLocation:(ZFPanLocation)location
- withVelocity:(CGPoint)velocity;
- /**
- When the end panGesture
- */
- - (void)gestureEndedPan:(ZFPlayerGestureControl *)gestureControl
- panDirection:(ZFPanDirection)direction
- panLocation:(ZFPanLocation)location;
- /**
- When the pinchGesture changed
- */
- - (void)gesturePinched:(ZFPlayerGestureControl *)gestureControl
- scale:(float)scale;
- #pragma mark - scrollview
- /**
- When the player will appear in scrollView.
- */
- - (void)playerWillAppearInScrollView:(ZFPlayerController *)videoPlayer;
- /**
- When the player did appear in scrollView.
- */
- - (void)playerDidAppearInScrollView:(ZFPlayerController *)videoPlayer;
- /**
- When the player will disappear in scrollView.
- */
- - (void)playerWillDisappearInScrollView:(ZFPlayerController *)videoPlayer;
- /**
- When the player did disappear in scrollView.
- */
- - (void)playerDidDisappearInScrollView:(ZFPlayerController *)videoPlayer;
- /**
- When the player appearing in scrollView.
- */
- - (void)playerAppearingInScrollView:(ZFPlayerController *)videoPlayer playerApperaPercent:(CGFloat)playerApperaPercent;
- /**
- When the player disappearing in scrollView.
- */
- - (void)playerDisappearingInScrollView:(ZFPlayerController *)videoPlayer playerDisapperaPercent:(CGFloat)playerDisapperaPercent;
- /**
- When the small float view show.
- */
- - (void)videoPlayer:(ZFPlayerController *)videoPlayer floatViewShow:(BOOL)show;
- @end
- NS_ASSUME_NONNULL_END
|