diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7cbcb3fb1..a416e74bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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`.
diff --git a/XCDYouTubeKit Demo/OS X Demo/Supporting Files/XCDYouTubeKit OS X Demo-Info.plist b/XCDYouTubeKit Demo/OS X Demo/Supporting Files/XCDYouTubeKit OS X Demo-Info.plist
index 75bf54c5d..b26117c48 100644
--- a/XCDYouTubeKit Demo/OS X Demo/Supporting Files/XCDYouTubeKit OS X Demo-Info.plist
+++ b/XCDYouTubeKit Demo/OS X Demo/Supporting Files/XCDYouTubeKit OS X Demo-Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
${CURRENT_PROJECT_VERSION}
CFBundleVersion
- 1
+ 2
LSApplicationCategoryType
public.app-category.entertainment
LSMinimumSystemVersion
diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj
index 10419170a..0e6f2b93e 100644
--- a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj
+++ b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj
@@ -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;
@@ -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;
diff --git a/XCDYouTubeKit Demo/iOS Demo/DemoInlineViewController.m b/XCDYouTubeKit Demo/iOS Demo/DemoInlineViewController.m
index b0c9fb467..771263f0a 100644
--- a/XCDYouTubeKit Demo/iOS Demo/DemoInlineViewController.m
+++ b/XCDYouTubeKit Demo/iOS Demo/DemoInlineViewController.m
@@ -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];
diff --git a/XCDYouTubeKit Demo/iOS Demo/MPMoviePlayerController+BackgroundPlayback.m b/XCDYouTubeKit Demo/iOS Demo/MPMoviePlayerController+BackgroundPlayback.m
index b489ac662..b2dd5204b 100644
--- a/XCDYouTubeKit Demo/iOS Demo/MPMoviePlayerController+BackgroundPlayback.m
+++ b/XCDYouTubeKit Demo/iOS Demo/MPMoviePlayerController+BackgroundPlayback.m
@@ -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];
});
@@ -41,8 +41,8 @@ - (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);
@@ -50,12 +50,12 @@ - (void) setBackgroundPlaybackEnabled:(BOOL)backgroundPlaybackEnabled
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;
}
@@ -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)
diff --git a/XCDYouTubeKit Demo/iOS Demo/Supporting Files/XCDYouTubeKit iOS Demo-Info.plist b/XCDYouTubeKit Demo/iOS Demo/Supporting Files/XCDYouTubeKit iOS Demo-Info.plist
index f082e17c4..8d82f12b0 100644
--- a/XCDYouTubeKit Demo/iOS Demo/Supporting Files/XCDYouTubeKit iOS Demo-Info.plist
+++ b/XCDYouTubeKit Demo/iOS Demo/Supporting Files/XCDYouTubeKit iOS Demo-Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
${CURRENT_PROJECT_VERSION}
CFBundleVersion
- 1
+ 2
LSRequiresIPhoneOS
UIBackgroundModes
diff --git a/XCDYouTubeKit Demo/iOS Demo/en.lproj/MainStoryboard.storyboard b/XCDYouTubeKit Demo/iOS Demo/en.lproj/MainStoryboard.storyboard
index 8046d7d29..870767a43 100644
--- a/XCDYouTubeKit Demo/iOS Demo/en.lproj/MainStoryboard.storyboard
+++ b/XCDYouTubeKit Demo/iOS Demo/en.lproj/MainStoryboard.storyboard
@@ -1,5 +1,5 @@
-
+
@@ -10,7 +10,7 @@
-
+
@@ -26,11 +26,11 @@
-
+
-
+
@@ -49,10 +49,9 @@
-
-
+
-
@@ -100,14 +98,14 @@
-
+
-
+
@@ -127,7 +125,7 @@
-
+
@@ -147,7 +145,7 @@
-
+
@@ -167,7 +165,7 @@
-
+
@@ -207,11 +205,11 @@
-
+
-
+
-
@@ -266,13 +263,12 @@
-
+