YKMediaPlayerKit icon indicating copy to clipboard operation
YKMediaPlayerKit copied to clipboard

Files in Git repository different from CocoaPods

Open penacristian opened this issue 9 years ago • 2 comments
trafficstars

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?

penacristian avatar Apr 11 '16 14:04 penacristian

Second this, the cocoa pods repository needs updating with the latest git hub version

Reedyuk avatar Apr 27 '16 13:04 Reedyuk

This project doesn't seem to be maintained anymore.

agordeev avatar May 22 '16 10:05 agordeev