mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-19 12:10:21 +08:00
tap proxy
This commit is contained in:
@@ -100,6 +100,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
#pragma mark ASVideoNodeDelegate proxy methods
|
||||
/**
|
||||
* @abstract Delegate method invoked when ASVideoPlayerNode playback time is taped.
|
||||
* @param videoPlayerNode The ASVideoPlayerNode that was tapped.
|
||||
*/
|
||||
- (void)videoPlayerNodeWasTapped:(ASVideoPlayerNode *)videoPlayer;
|
||||
/**
|
||||
* @abstract Delegate method invoked when ASVideoNode playback time is updated.
|
||||
* @param videoPlayerNode The video node that was tapped.
|
||||
|
||||
@@ -31,6 +31,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
unsigned int delegateVideoNodeWillChangeState:1;
|
||||
unsigned int delegateVideoNodeShouldChangeState:1;
|
||||
unsigned int delegateVideoNodePlaybackDidFinish:1;
|
||||
unsigned int delegateVideoNodeTapped:1;
|
||||
} _delegateFlags;
|
||||
|
||||
NSURL *_url;
|
||||
@@ -393,10 +394,14 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
|
||||
- (void)videoNodeWasTapped:(ASVideoNode *)videoNode
|
||||
{
|
||||
if (videoNode.playerState == ASVideoNodePlayerStatePlaying) {
|
||||
[videoNode pause];
|
||||
if (_delegateFlags.delegateVideoNodeTapped) {
|
||||
[_delegate videoPlayerNodeWasTapped:self];
|
||||
} else {
|
||||
[videoNode play];
|
||||
if (videoNode.playerState == ASVideoNodePlayerStatePlaying) {
|
||||
[videoNode pause];
|
||||
} else {
|
||||
[videoNode play];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,6 +565,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
_delegateFlags.delegateVideoNodeShouldChangeState = [_delegate respondsToSelector:@selector(videoPlayerNode:shouldChangeVideoNodeStateTo:)];
|
||||
_delegateFlags.delegateTimeLabelAttributedString = [_delegate respondsToSelector:@selector(videoPlayerNode:timeStringForTimeLabelType:forTime:)];
|
||||
_delegateFlags.delegatePlaybackButtonTint = [_delegate respondsToSelector:@selector(videoPlayerNodePlaybackButtonTint:)];
|
||||
_delegateFlags.delegateVideoNodeTapped = [_delegate respondsToSelector:@selector(videoPlayerNodeWasTapped:)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user