Skip to content

Commit

Permalink
Handle all ways of initializing XCDYouTubeVideoPlayerViewController
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Jun 4, 2014
1 parent 478f080 commit 889b014
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion XCDYouTubeKit/XCDYouTubeVideoPlayerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,27 @@ @interface XCDYouTubeVideoPlayerViewController ()

@implementation XCDYouTubeVideoPlayerViewController

/*
* MPMoviePlayerViewController on iOS 7 and earlier
* - (id) init
* `-- [super init]
*
* - (id) initWithContentURL:(NSURL *)contentURL
* |-- [self init]
* `-- [self.moviePlayer setContentURL:contentURL]
*
* MPMoviePlayerViewController on iOS 8 and later
* - (id) init
* `-- [self initWithContentURL:nil]
*
* - (id) initWithContentURL:(NSURL *)contentURL
* |-- [super init]
* `-- [self.moviePlayer setContentURL:contentURL]
*/

- (instancetype) init
{
return [self initWithVideoIdentifier:nil];
return [[[UIDevice currentDevice] systemVersion] integerValue] >= 8 ? [self initWithVideoIdentifier:nil] : [super init];
}

- (instancetype) initWithContentURL:(NSURL *)contentURL
Expand Down

0 comments on commit 889b014

Please sign in to comment.