Skip to content

Commit

Permalink
fix visibility notification
Browse files Browse the repository at this point in the history
  • Loading branch information
priore committed Jun 26, 2017
1 parent 5ea988c commit 207c5d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .swift-version
@@ -0,0 +1 @@
3.0
2 changes: 1 addition & 1 deletion AVPlayerOverlay.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AVPlayerOverlay'
s.version = '1.10'
s.version = '1.10.1'
s.summary = 'AVPlayer with custom controls and full screen features.'
s.license = 'MIT'
s.authors = { 'Danilo Priore' => 'support@prioregroup.com' }
Expand Down
8 changes: 5 additions & 3 deletions AVPlayerOverlay/AVPlayer/AVPlayerVC.h
Expand Up @@ -4,9 +4,11 @@
// Created by Danilo Priore on 28/04/16.
// Copyright © 2016 Prioregroup.com. All rights reserved.
//
#define AVPlayerVCSetVideoURLNotification @"avplayervcsetvideourl"
#define AVPlayerVCVisibilityNotification @"avplayervcvisibility"
#define kAVPlayerVCSubtitleURL @"subtitles"
#define AVPlayerVCSetVideoURLNotification @"avplayervcsetvideourl"
#define AVPlayerVCVisibilityNotification @"avplayervcvisibility"

#define kAVPlayerVCSubtitleURL @"subtitles"
#define kAVPlayerVCVisibilityState @"visibility"

#import "AVPlayerOverlayVC.h"
#import "AVPlayerPIPOverlayVC.h"
Expand Down
4 changes: 2 additions & 2 deletions AVPlayerOverlay/AVPlayer/AVPlayerVC.m
Expand Up @@ -96,10 +96,10 @@ - (void)viewDidLoad
if (rect.size.width > 0 && rect.size.height > 0) {
if (CGRectContainsRect(self.view.window.frame, rect) && !visibility) {
visibility = YES;
[[NSNotificationCenter defaultCenter] postNotificationName:AVPlayerVCVisibilityNotification object:@(YES)];
[[NSNotificationCenter defaultCenter] postNotificationName:AVPlayerVCVisibilityNotification object:self userInfo:@{kAVPlayerVCVisibilityState: @(YES)}];
} else if (!CGRectContainsRect(self.view.window.frame, rect) && visibility) {
visibility = NO;
[[NSNotificationCenter defaultCenter] postNotificationName:AVPlayerVCVisibilityNotification object:@(NO)];
[[NSNotificationCenter defaultCenter] postNotificationName:AVPlayerVCVisibilityNotification object:self userInfo:@{kAVPlayerVCVisibilityState: @(NO)}];
}
}
}];
Expand Down

0 comments on commit 207c5d3

Please sign in to comment.