diff --git a/CHANGELOG.md b/CHANGELOG.md
index caccbc0f..5f0c2405 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+#### Version 1.1.2
+
+* Adaptation to YouTube API change. (#19)
+
#### Version 1.1.1
* For errors of the `XCDYouTubeVideoErrorDomain` domain, `-[NSError localizedDescription]` is actually localized and doesn’t contain HTML tags, making it suitable for displaying to the user.
diff --git a/XCDYouTubeVideoPlayerViewController.podspec b/XCDYouTubeVideoPlayerViewController.podspec
index 9a92b4b8..249b16a0 100644
--- a/XCDYouTubeVideoPlayerViewController.podspec
+++ b/XCDYouTubeVideoPlayerViewController.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "XCDYouTubeVideoPlayerViewController"
- s.version = "1.1.1"
+ s.version = "1.1.2"
s.summary = "YouTube video player for iPhone and iPad."
s.homepage = "https://github.com/0xced/XCDYouTubeVideoPlayerViewController"
s.license = 'MIT'
diff --git a/XCDYouTubeVideoPlayerViewController.xcodeproj/project.pbxproj b/XCDYouTubeVideoPlayerViewController.xcodeproj/project.pbxproj
index bfbb87cf..8b892f1a 100644
--- a/XCDYouTubeVideoPlayerViewController.xcodeproj/project.pbxproj
+++ b/XCDYouTubeVideoPlayerViewController.xcodeproj/project.pbxproj
@@ -157,7 +157,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
COPY_PHASE_STRIP = NO;
- DYLIB_COMPATIBILITY_VERSION = 1.1.1;
+ DYLIB_COMPATIBILITY_VERSION = 1.1.2;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
@@ -199,7 +199,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
COPY_PHASE_STRIP = YES;
- DYLIB_COMPATIBILITY_VERSION = 1.1.1;
+ DYLIB_COMPATIBILITY_VERSION = 1.1.2;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
diff --git a/XCDYouTubeVideoPlayerViewController/XCDYouTubeVideoPlayerViewController.m b/XCDYouTubeVideoPlayerViewController/XCDYouTubeVideoPlayerViewController.m
index f95de8ed..da556e11 100644
--- a/XCDYouTubeVideoPlayerViewController/XCDYouTubeVideoPlayerViewController.m
+++ b/XCDYouTubeVideoPlayerViewController/XCDYouTubeVideoPlayerViewController.m
@@ -242,7 +242,8 @@ - (NSURL *) videoURLWithData:(NSData *)data error:(NSError * __autoreleasing *)e
NSString *videoQuery = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSStringEncoding queryEncoding = NSUTF8StringEncoding;
NSDictionary *video = DictionaryWithQueryString(videoQuery, queryEncoding);
- NSArray *streamQueries = [video[@"url_encoded_fmt_stream_map"] componentsSeparatedByString:@","];
+ NSMutableArray *streamQueries = [[video[@"url_encoded_fmt_stream_map"] componentsSeparatedByString:@","] mutableCopy];
+ [streamQueries addObjectsFromArray:[video[@"adaptive_fmts"] componentsSeparatedByString:@","]];
NSMutableDictionary *streamURLs = [NSMutableDictionary new];
for (NSString *streamQuery in streamQueries)
@@ -250,11 +251,15 @@ - (NSURL *) videoURLWithData:(NSData *)data error:(NSError * __autoreleasing *)e
NSDictionary *stream = DictionaryWithQueryString(streamQuery, queryEncoding);
NSString *type = stream[@"type"];
NSString *urlString = stream[@"url"];
- NSString *signature = stream[@"sig"];
- if (urlString && signature && [AVURLAsset isPlayableExtendedMIMEType:type])
+ if (urlString && [AVURLAsset isPlayableExtendedMIMEType:type])
{
- NSURL *streamURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@&signature=%@", urlString, signature]];
- streamURLs[@([stream[@"itag"] integerValue])] = streamURL;
+ NSURL *streamURL = [NSURL URLWithString:urlString];
+ NSString *signature = stream[@"sig"];
+ if (signature)
+ streamURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@&signature=%@", urlString, signature]];
+
+ if ([[DictionaryWithQueryString(streamURL.query, queryEncoding) allKeys] containsObject:@"signature"])
+ streamURLs[@([stream[@"itag"] integerValue])] = streamURL;
}
}
diff --git a/YouTube Video Player Demo/Supporting Files/YouTube Video Player Demo-Info.plist b/YouTube Video Player Demo/Supporting Files/YouTube Video Player Demo-Info.plist
index 5abf8ea0..b94a4c45 100644
--- a/YouTube Video Player Demo/Supporting Files/YouTube Video Player Demo-Info.plist
+++ b/YouTube Video Player Demo/Supporting Files/YouTube Video Player Demo-Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.1.1
+ 1.1.2
CFBundleVersion
0
LSRequiresIPhoneOS