YKMediaPlayerKit
YKMediaPlayerKit copied to clipboard
Files in Git repository different from CocoaPods
I've been struggling with an issue all day. I downloaded the library via cocoapods and the file YKVimeoVideo contained the following method
`- (void)parseWithCompletion:(void(^)(NSError *))callback { NSAssert(self.contentURL, @"Invalid contentURL"); NSAssert(self.videoID, @"Vimeo URL is invalid");
BOOL (^callback_if_error)(NSError *) = ^(NSError *error){
if (error) {
if (callback) {
dispatch_async(dispatch_get_main_queue(), ^{ callback(error); });
}
return YES;
}
return NO;
};
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSError *error;
NSString *dataURL = [NSString stringWithFormat:kVideoConfigURL, self.videoID];
NSString *data = [NSString stringWithContentsOfURL:[NSURL URLWithString:dataURL] encoding:NSUTF8StringEncoding error:&error];
if (callback_if_error(error)) return;
NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:[data dataUsingEncoding:NSUTF8StringEncoding]
options:NSJSONReadingAllowFragments
error:&error];
if (callback_if_error(error)) return;
self.videos = [jsonData valueForKeyPath:@"request.files.h264"];
self.thumbs = [jsonData valueForKeyPath:@"video.thumbs"];
if (callback) {
dispatch_async(dispatch_get_main_queue(), ^{
callback(nil);
});
}
});
}`
The git repository has the following `- (void)parseWithCompletion:(void(^)(NSError *))callback { NSAssert(self.contentURL, @"Invalid contentURL"); NSAssert(self.videoID, @"Vimeo URL is invalid");
BOOL (^callback_if_error)(NSError *) = ^(NSError *error){
if (error) {
if (callback) {
dispatch_async(dispatch_get_main_queue(), ^{ callback(error); });
}
return YES;
}
return NO;
};
[IGVimeoExtractor fetchVideoURLFromURL:[self.contentURL absoluteString] completionHandler:^(NSArray<IGVimeoVideo *> * _Nullable videos, NSError * _Nullable error) {
if (callback_if_error(error)) return;
self.videos = [[self class] videosDictionary:videos];
self.thumbs = [[self class] thumbsDictionary:videos];
if (callback) {
dispatch_async(dispatch_get_main_queue(), ^{
callback(nil);
});
}
}];
} `
The cocoapods code doesn't work. Any idea why the differences?
Second this, the cocoa pods repository needs updating with the latest git hub version
This project doesn't seem to be maintained anymore.