Skip to content

Commit

Permalink
Merge branch 'release/2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Jun 19, 2014
2 parents 8c26c8d + 4c26bff commit 827766e
Show file tree
Hide file tree
Showing 17 changed files with 181 additions and 49 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#### Version 2.0.1

* Fixed crash on protected videos. (#46)
* Ensure that the video doesn’t disappear after locking the device. (#36)
* Demo app: do not crash when going to background very quickly after presenting a video. (#44)

#### Version 2.0.0

* Project renamed to `XCDYouTubeKit`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.entertainment</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.0.0;
CURRENT_PROJECT_VERSION = 2.0.1;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -476,7 +476,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 2.0.0;
CURRENT_PROJECT_VERSION = 2.0.1;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PREPROCESSOR_DEFINITIONS = "NS_BLOCK_ASSERTIONS=1";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
Expand Down
2 changes: 2 additions & 0 deletions XCDYouTubeKit Demo/iOS Demo/DemoInlineViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ @implementation DemoInlineViewController

- (void) viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];

// Beware, viewWillDisappear: is called when the player view enters full screen on iOS 6+
if ([self isMovingFromParentViewController])
[self.videoPlayerViewController.moviePlayer stop];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ + (void) load
dispatch_async(dispatch_get_main_queue(), ^{
// Register for these notifications as early as possible in order to be called before -[MPAVController _applicationWillResignActive:] which calls `_pausePlaybackIfNecessary`.
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:self selector:@selector(backgroundPlayback_moviePlayerNowPlayingMovieDidChangeNotification:) name:MPMoviePlayerNowPlayingMovieDidChangeNotification object:nil];
[defaultCenter addObserver:self selector:@selector(backgroundPlayback_moviePlayerPlaybackDidFinishNotification:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[defaultCenter addObserver:self selector:@selector(backgroundPlayback_moviePlayerNowPlayingMovieDidChange:) name:MPMoviePlayerNowPlayingMovieDidChangeNotification object:nil];
[defaultCenter addObserver:self selector:@selector(backgroundPlayback_moviePlayerPlaybackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[defaultCenter addObserver:self selector:@selector(backgroundPlayback_applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
[defaultCenter addObserver:self selector:@selector(backgroundPlayback_applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
});
Expand All @@ -41,21 +41,21 @@ - (void) setBackgroundPlaybackEnabled:(BOOL)backgroundPlaybackEnabled
if (backgroundPlaybackEnabled)
{
NSArray *backgroundModes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
if ([backgroundModes isKindOfClass:[NSArray class]] && ![backgroundModes containsObject:@"audio"])
NSLog(@"ERROR: The `UIBackgroundModes` array in the application Info.plist file must contain the `audio` element.");
if (!backgroundModes || ([backgroundModes isKindOfClass:[NSArray class]] && ![backgroundModes containsObject:@"audio"]))
NSLog(@"ERROR: The `UIBackgroundModes` array in the application Info.plist file must contain the `audio` element for background playback.");
}

objc_setAssociatedObject(self, BackgroundPlaybackEnabledKey, @(backgroundPlaybackEnabled), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

static __weak MPMoviePlayerController *currentMoviePlayerController;

+ (void) backgroundPlayback_moviePlayerNowPlayingMovieDidChangeNotification:(NSNotification *)notification
+ (void) backgroundPlayback_moviePlayerNowPlayingMovieDidChange:(NSNotification *)notification
{
currentMoviePlayerController = notification.object;
}

+ (void) backgroundPlayback_moviePlayerPlaybackDidFinishNotification:(NSNotification *)notification
+ (void) backgroundPlayback_moviePlayerPlaybackDidFinish:(NSNotification *)notification
{
currentMoviePlayerController = nil;
}
Expand Down Expand Up @@ -93,6 +93,9 @@ + (void) backgroundPlayback_moviePlayerPlaybackDidFinishNotification:(NSNotifica

+ (void) backgroundPlayback_applicationWillResignActive:(NSNotification *)notification
{
if (!currentMoviePlayerController)
return;

AVPlayerLayer *playerLayer = PlayerLayer();
objc_setAssociatedObject(currentMoviePlayerController, PlayerKey, playerLayer.player, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
if (currentMoviePlayerController.isBackgroundPlaybackEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIBackgroundModes</key>
Expand Down
Loading

0 comments on commit 827766e

Please sign in to comment.