Skip to content

Commit

Permalink
conflict fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliza Sapir committed May 28, 2014
2 parents 95bb233 + 51cd5d4 commit 4046465
Showing 1 changed file with 92 additions and 26 deletions.
118 changes: 92 additions & 26 deletions PlayerSDK/PlayerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#import "KPEventListener.h"
#if !(TARGET_IPHONE_SIMULATOR)
#import "WVSettings.h"
#import "WViPhoneAPI.h"
#import "WVSettings.h"
#import "WViPhoneAPI.h"
#endif

@implementation PlayerViewController {
Expand All @@ -30,6 +30,9 @@ @implementation PlayerViewController {
BOOL openFullScreen;
UIButton *btn;
BOOL isCloseFullScreenByTap;
// AirPlay Params
MPVolumeView *volumeView;
NSArray *prevAirPlayBtnPositionArr;

BOOL isJsCallbackReady;
NSMutableDictionary *kPlayerEventsDict;
Expand All @@ -49,9 +52,9 @@ @implementation PlayerViewController {
- (void)viewDidLoad {
NSLog(@"View Did Load Enter");

#if !(TARGET_IPHONE_SIMULATOR)
[self initWideVineParams];
#endif
#if !(TARGET_IPHONE_SIMULATOR)
[self initWideVineParams];
#endif
[self initPlayerParams];

appConfigDict = [NSDictionary dictionaryWithContentsOfFile: [ [NSBundle mainBundle] pathForResource: @"AppConfigurations" ofType: @"plist"]];
Expand Down Expand Up @@ -149,11 +152,11 @@ - (void)play {

isPlayCalled = YES;

#if !(TARGET_IPHONE_SIMULATOR)
if ( isWideVine && !isWideVineReady ) {
return;
}
#endif
#if !(TARGET_IPHONE_SIMULATOR)
if ( isWideVine && !isWideVineReady ) {
return;
}
#endif

if( !( self.player.playbackState == MPMoviePlaybackStatePlaying ) ) {
[self.player prepareToPlay];
Expand Down Expand Up @@ -182,14 +185,14 @@ - (void)stop {
isPlaying = NO;
isPlayCalled = NO;

#if !(TARGET_IPHONE_SIMULATOR)
// Stop WideVine
if ( isWideVine ) {
[wvSettings stopWV];
isWideVine = NO;
isWideVineReady = NO;
}
#endif
#if !(TARGET_IPHONE_SIMULATOR)
// Stop WideVine
if ( isWideVine ) {
[wvSettings stopWV];
isWideVine = NO;
isWideVineReady = NO;
}
#endif

NSLog(@"Stop Player Exit");
}
Expand Down Expand Up @@ -455,7 +458,7 @@ - (void)openFullScreen: (BOOL)openFullscreen{
NSLog( @"openFullScreen Enter" );

isFullScreen = YES;

CGRect mainFrame;
openFullScreen = openFullscreen;

Expand Down Expand Up @@ -509,7 +512,7 @@ - (void)closeFullScreen{
self.webView.frame = self.player.view.frame;

if ( ![self isIOS7] ) {
[UIApplication sharedApplication].statusBarHidden = NO;
[UIApplication sharedApplication].statusBarHidden = NO;
}

[self triggerEventsJavaScript:@"exitfullscreen" WithValue:nil];
Expand Down Expand Up @@ -713,7 +716,7 @@ - (void)setAttribute: (NSArray*)args{
attributeVal = [args objectAtIndex:1];
[self visible: attributeVal];
break;
#if !(TARGET_IPHONE_SIMULATOR)
#if !(TARGET_IPHONE_SIMULATOR)
case wvServerKey:
wvSettings = [[WVSettings alloc] init];
isWideVine = YES;
Expand All @@ -724,8 +727,8 @@ - (void)setAttribute: (NSArray*)args{
attributeVal = [args objectAtIndex:1];
[self initWV: playerSource andKey: attributeVal];
break;
#endif

#endif
default:
break;
}
Expand Down Expand Up @@ -809,9 +812,22 @@ - (void)stopAndRemovePlayer{
player = nil;
self.webView = nil;

[self removeAirPlayIcon];

NSLog(@"stopAndRemovePlayer Exit");
}

- (void)removeAirPlayIcon {
NSLog(@"removeAirPlayIcon Enter");

if ( volumeView ) {
[volumeView removeFromSuperview];
volumeView = nil;
}

NSLog(@"removeAirPlayIcon Exit");
}

- (void)doneFSBtnPressed {
NSLog(@"doneFSBtnPressed Enter");

Expand All @@ -821,6 +837,56 @@ - (void)doneFSBtnPressed {
NSLog(@"doneFSBtnPressed Exit");
}

#pragma mark - airplay plugin
- (void)addNativeAirPlayButton {
NSLog(@"addNativeAirPlayButton Enter");

// Add airplay
self.view.backgroundColor = [UIColor clearColor];
if ( !volumeView ) {
volumeView = [ [MPVolumeView alloc] init ];
[volumeView setShowsVolumeSlider: NO];
}

NSLog(@"addNativeAirPlayButton Exit");
}

-(void)showNativeAirPlayButton: (NSArray*)airPlayBtnPositionArr {
NSLog(@"showNativeAirPlayButton Enter");

if ( volumeView.hidden ) {
volumeView.hidden = NO;

if ( prevAirPlayBtnPositionArr == nil || ![prevAirPlayBtnPositionArr isEqualToArray: airPlayBtnPositionArr] ) {
prevAirPlayBtnPositionArr = airPlayBtnPositionArr;
}else {
return;
}
}

CGFloat x = [[airPlayBtnPositionArr objectAtIndex:0] floatValue];
CGFloat y = [[airPlayBtnPositionArr objectAtIndex:1] floatValue];
CGFloat w = [[airPlayBtnPositionArr objectAtIndex:2] floatValue];
CGFloat h = [[airPlayBtnPositionArr objectAtIndex:3] floatValue];

volumeView.frame = CGRectMake( x, y, w, h );

[self.view addSubview: volumeView];
[self.view bringSubviewToFront: volumeView];

NSLog(@"showNativeAirPlayButton Exit");
}

-(void)hideNativeAirPlayButton {
NSLog(@"hideNativeAirPlayButton Enter");

if ( !volumeView.hidden ) {
volumeView.hidden = YES;
}

NSLog(@"hideNativeAirPlayButton Exit");
}

- (BOOL)isIpad{

return ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
Expand Down Expand Up @@ -900,9 +966,9 @@ - (Attribute)attributeNameEnumFromString{
NSDictionary *Attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInteger:src], @"src",
[NSNumber numberWithInteger:currentTime], @"currentTime",
#if !(TARGET_IPHONE_SIMULATOR)
[NSNumber numberWithInteger:wvServerKey], @"wvServerKey",
#endif
#if !(TARGET_IPHONE_SIMULATOR)
[NSNumber numberWithInteger:wvServerKey], @"wvServerKey",
#endif
nil
];
NSLog(@"attributeNameEnumFromString Exit");
Expand Down

0 comments on commit 4046465

Please sign in to comment.