Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions GUIPlayerView/Classes/GUIPlayerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ @interface GUIPlayerView () <AVAssetResourceLoaderDelegate, NSURLConnectionDataD
@property (assign, nonatomic) BOOL seeking;
@property (assign, nonatomic) BOOL fullscreen;
@property (assign, nonatomic) CGRect defaultFrame;
@property (assign, nonatomic) BOOL isControllersViewInAnimation;

@end

Expand Down Expand Up @@ -243,7 +244,7 @@ - (void)setup {
[progressIndicator addTarget:self action:@selector(resumeRefreshing) forControlEvents:UIControlEventTouchUpInside|
UIControlEventTouchUpOutside];

[self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showControllers)]];
[self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleControllerAlpha)]];
[self showControllers];

controllersTimeoutPeriod = 3;
Expand Down Expand Up @@ -422,7 +423,20 @@ - (void)refreshProgressIndicator {
}
}

- (void)toggleControllerAlpha
{
if (self.isControllersViewInAnimation) {
return;
}
if (controllersView.alpha == 0.0) {
[self showControllers];
} else if(controllersView.alpha == 1.0) {
[self hideControllers];
}
}

- (void)showControllers {
self.isControllersViewInAnimation = YES;
[UIView animateWithDuration:0.2f animations:^{
[controllersView setAlpha:1.0f];
} completion:^(BOOL finished) {
Expand All @@ -435,12 +449,16 @@ - (void)showControllers {
userInfo:nil
repeats:NO];
}
self.isControllersViewInAnimation = NO;
}];
}

- (void)hideControllers {
[UIView animateWithDuration:0.5f animations:^{
self.isControllersViewInAnimation = YES;
[UIView animateWithDuration:0.3f animations:^{
[controllersView setAlpha:0.0f];
} completion:^(BOOL finished) {
self.isControllersViewInAnimation = NO;
}];
}

Expand Down