Skip to content

Commit

Permalink
Add two convenience methods
Browse files Browse the repository at this point in the history
- These are used to quickly extract specific streams. For example, you
can now quickly get the highest stream URL or the lowest stream URL.
  • Loading branch information
SoneeJohn committed Dec 27, 2015
1 parent 452f9d5 commit d80f87b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions YTVimeoExtractor/YTVimeoVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,19 @@ typedef NS_ENUM(NSUInteger, YTVimeoVideoQuality) {
* A `NSDictionary` object that contains all the metadata about the video.
*/
@property (nonatomic, readonly) NSDictionary *__nullable metaData;
/**
* Convenience method to get the highest quality stream URL.
*
* @see YTVimeoVideoQuality
* @return The highest quality stream URL.
*/
-(NSURL *__nullable)highestQualityStreamURL;
/**
* Convenience method to get the lowest quality stream URL.
*
* @see YTVimeoVideoQuality
* @return The lowest quality stream URL.
*/
-(NSURL *__nullable)lowestQualityStreamURL;

@end
14 changes: 14 additions & 0 deletions YTVimeoExtractor/YTVimeoVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ - (void)extractVideoInfoWithCompletionHandler:(void (^)(NSError *error))completi
});
}

#pragma mark -
-(NSURL *)highestQualityStreamURL{

NSURL *url = self.streamURLs[@(YTVimeoVideoQualityHD1080)] ?: self.streamURLs[@(YTVimeoVideoQualityHD720)] ?: self.streamURLs [@(YTVimeoVideoQualityMedium480)]?: self.streamURLs[@(YTVimeoVideoQualityMedium360)]?:self.streamURLs[@(YTVimeoVideoQualityLow270)];

return url;
}

-(NSURL *)lowestQualityStreamURL{

NSURL *url = self.streamURLs[@(YTVimeoVideoQualityLow270)] ?: self.streamURLs[@(YTVimeoVideoQualityMedium360)] ?: self.streamURLs [@(YTVimeoVideoQualityMedium480)]?: self.streamURLs[@(YTVimeoVideoQualityHD720)]?:self.streamURLs[@(YTVimeoVideoQualityHD1080)];

return url;
}

#pragma mark - NSObject
- (NSString *) description
Expand Down

0 comments on commit d80f87b

Please sign in to comment.