Skip to content

Commit

Permalink
Merge pull request #42 from lilfaf/development
Browse files Browse the repository at this point in the history
Development merge v1.2.0
  • Loading branch information
SoneeJohn committed Mar 31, 2016
2 parents db6d538 + 7e2f26a commit 44103fb
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 71 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ osx_image: xcode7.1
before_install:
- brew update
- brew install carthage
script: xctool -project YTVimeoExtractor.xcodeproj -scheme YTVimeoExtractor test
script: xctool -project YTVimeoExtractor.xcodeproj -scheme YTVimeoExtractor build test GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
after_success:
- bash <(curl -s https://codecov.io/bash)
before_deploy:
- carthage build --no-skip-current
- carthage archive YTVimeoExtractor
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

### Version 1.2.0

* New `HTTPLiveStreamURL` property on the `YTVimeoVideo` class. ([#38](https://github.com/lilfaf/YTVimeoExtractor/issues/38))
* Add `YTVimeoVideoQualityMedium540` enum value on the `YTVimeoVideo` class. ([#40](https://github.com/lilfaf/YTVimeoExtractor/issues/40))

### Version 1.1.0

* The `streamURLs` and `thumbnailURLs` are now dictionaries that contain NSURLs ([e179efc](https://github.com/lilfaf/YTVimeoExtractor/commit/e179efc395ea8f287a9a9acb1b4b1398e92e24ce), [385ae37](https://github.com/lilfaf/YTVimeoExtractor/commit/385ae372660f52a0061b3c73f7d5df0cd5b33cc3))
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
[![Build Status](https://travis-ci.org/lilfaf/YTVimeoExtractor.svg?branch=master)](https://travis-ci.org/lilfaf/YTVimeoExtractor)
[![Carthage
compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![codecov.io](https://codecov.io/github/lilfaf/YTVimeoExtractor/coverage.svg?branch=development)](https://codecov.io/github/lilfaf/YTVimeoExtractor?branch=development)
[![GitHub release](https://img.shields.io/github/release/lilfaf/YTVimeoExtractor.svg)](https://github.com/lilfaf/YTVimeoExtractor/releases)
[![CocoaPods Platform Status](https://img.shields.io/cocoapods/p/YTVimeoExtractor.svg)](https://github.com/lilfaf/YTVimeoExtractor/releases)
[![CocoaPods Docs](https://img.shields.io/cocoapods/metrics/doc-percent/YTVimeoExtractor.svg)](http://cocoadocs.org/docsets/YTVimeoExtractor/)

YTVimeoExtractor extracts the MP4 streams of Vimeo videos, which then can be used to play via a `MPMoviePlayerViewController` or `AVPlayerView`.

Expand All @@ -20,7 +24,7 @@ YTVimeoExtractor extracts the MP4 streams of Vimeo videos, which then can be use
| `YTVimeoExtractor` | The `YTVimeoExtractor` is the main class and its sole purpose is to fetch information about Vimeo videos. Use the two main methods `fetchVideoWithIdentifier:withReferer:completionHandler:` or `fetchVideoWithVimeoURL:withReferer:completionHandler:` to obtain video information. |
| `YTVimeoExtractorOperation` | `YTVimeoExtractorOperation` is a subclass of `NSOperation` and is used to fetch and parse out information about Vimeo videos. This a low level class. Generally speaking, you should use the higher level `YTVimeoExtractor` class. |
|`YTVimeoURLParser` | `YTVimeoURLParser` is used to validate and parse put Vimeo URLs. The main purpose of the class is to check if a given URL can be handled by the `YTVimeoExtractor` class.|
|`YTVimeoVideo`| `YTVimeoVideo` represents a Vimeo video. Use this class to access information about a particular video. Generally, you should not initialize this class, instead use the two main methods of the `YTVimeoExtractor` class.|
|`YTVimeoVideo`| `YTVimeoVideo` represents a Vimeo video. Use this class to access information about a particular video. Do not manually initialize a `YTVimeoVideo` object. Using the `-init` method will throw an exception, instead use the two main methods of the `YTVimeoExtractor` class to obtain a `YTVimeoVideo` object. |

## Installation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ - (IBAction)playAction:(id)sender {
//Will get the highest available quality.
NSURL *highQualityURL = [video highestQualityStreamURL];


AVPlayer *player = [[AVPlayer alloc]initWithURL:highQualityURL];

self.playerView.player = player;
Expand Down
Binary file modified YTVimeoExtractor.framework.zip
Binary file not shown.
4 changes: 4 additions & 0 deletions YTVimeoExtractor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
019F95101C984EF400E2A405 /* YTVimeoVideo+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 019F950F1C984EF400E2A405 /* YTVimeoVideo+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
01AC343A1C1F21290015CAA6 /* YTVimeoExtractor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01AC342F1C1F21280015CAA6 /* YTVimeoExtractor.framework */; };
01AC34521C1F21750015CAA6 /* YTVimeoError.h in Headers */ = {isa = PBXBuildFile; fileRef = 01AC34491C1F21750015CAA6 /* YTVimeoError.h */; settings = {ATTRIBUTES = (Public, ); }; };
01AC34531C1F21750015CAA6 /* YTVimeoExtractor.h in Headers */ = {isa = PBXBuildFile; fileRef = 01AC344A1C1F21750015CAA6 /* YTVimeoExtractor.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -36,6 +37,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
019F950F1C984EF400E2A405 /* YTVimeoVideo+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YTVimeoVideo+Private.h"; sourceTree = "<group>"; };
01AC342F1C1F21280015CAA6 /* YTVimeoExtractor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YTVimeoExtractor.framework; sourceTree = BUILT_PRODUCTS_DIR; };
01AC34341C1F21290015CAA6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
01AC34391C1F21290015CAA6 /* YTVimeoExtractorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YTVimeoExtractorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -106,6 +108,7 @@
01AC344F1C1F21750015CAA6 /* YTVimeoURLParser.m */,
01AC34501C1F21750015CAA6 /* YTVimeoVideo.h */,
01AC34511C1F21750015CAA6 /* YTVimeoVideo.m */,
019F950F1C984EF400E2A405 /* YTVimeoVideo+Private.h */,
01AC34341C1F21290015CAA6 /* Info.plist */,
);
path = YTVimeoExtractor;
Expand Down Expand Up @@ -136,6 +139,7 @@
01AC34571C1F21750015CAA6 /* YTVimeoURLParser.h in Headers */,
01AC34531C1F21750015CAA6 /* YTVimeoExtractor.h in Headers */,
01AC34551C1F21750015CAA6 /* YTVimeoExtractorOperation.h in Headers */,
019F95101C984EF400E2A405 /* YTVimeoVideo+Private.h in Headers */,
01AC34591C1F21750015CAA6 /* YTVimeoVideo.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
4 changes: 2 additions & 2 deletions YTVimeoExtractor/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.0</string>
<string>1.2.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Louis Larpin. All rights reserved.</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion YTVimeoExtractor/YTVimeoError.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// YTVimeoError.h
// Sample
// YTVimeoExtractor
//
// Created by Soneé Delano John on 11/28/15.
// Copyright © 2015 Louis Larpin. All rights reserved.
Expand Down
10 changes: 8 additions & 2 deletions YTVimeoExtractor/YTVimeoExtractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
// Created by Louis Larpin on 18/02/13.
//

#if !__has_feature(nullability)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
#define nullable
#endif

#import <Foundation/Foundation.h>
#import "YTVimeoError.h"
#import "YTVimeoExtractorOperation.h"
Expand Down Expand Up @@ -42,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param referer The referer, if the Vimeo video has domain-level restrictions. If this value is `nil` then a default one will be used.
* @param completionHandler A block to execute when the extraction process is finished, which is executed on the main thread. If the completion handler is nil, this method throws an exception. The block has, two parameters a `YTVimeoVideo` object if, the operation was completed successfully and a `NSError` object describing the network or parsing error that may have occurred.
*/
-(void)fetchVideoWithIdentifier:(NSString *_Nonnull)videoIdentifier withReferer:(NSString *__nullable)referer completionHandler:(void (^_Nonnull)(YTVimeoVideo * __nullable video, NSError * __nullable error))completionHandler;
-(void)fetchVideoWithIdentifier:(NSString *)videoIdentifier withReferer:(NSString *__nullable)referer completionHandler:(void (^)(YTVimeoVideo * __nullable video, NSError * __nullable error))completionHandler;

/**
* Starts an asynchronous operation for the specified video URL, and referer, then calls a handler upon completion.
Expand All @@ -51,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param referer The referer, if the Vimeo video has domain-level restrictions. If this value is `nil` then a default one will be used.
* @param completionHandler A block to execute when the extraction process is finished, which is executed on the main thread. If the completion handler is nil, this method throws an exception. The block has, two parameters a `YTVimeoVideo` object if, the operation was completed successfully and a `NSError` object describing the network or parsing error that may have occurred.
*/
-(void)fetchVideoWithVimeoURL:(NSString *_Nonnull)videoURL withReferer:(NSString *__nullable)referer completionHandler:(void (^_Nonnull)(YTVimeoVideo * __nullable video, NSError * __nullable error))completionHandler;
-(void)fetchVideoWithVimeoURL:(NSString *)videoURL withReferer:(NSString *__nullable)referer completionHandler:(void (^)(YTVimeoVideo * __nullable video, NSError * __nullable error))completionHandler;

@end
NS_ASSUME_NONNULL_END
Expand Down
7 changes: 5 additions & 2 deletions YTVimeoExtractor/YTVimeoExtractor.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ +(instancetype)sharedExtractor{
return sharedExtractor;
}

- (id)init {
if (self = [super init]) {
- (instancetype)init {

self = [super init];

if (self) {

_extractorOperationQueue = [[NSOperationQueue alloc]init];
if ([_extractorOperationQueue respondsToSelector:@selector(qualityOfService)]) {
Expand Down
22 changes: 16 additions & 6 deletions YTVimeoExtractor/YTVimeoExtractorOperation.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
//
// YTVimeoExtractorOperation.h
// Sample
// YTVimeoExtractor
//
// Created by Soneé Delano John on 11/28/15.
// Copyright © 2015 Louis Larpin. All rights reserved.
//

#if !__has_feature(nullability)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
#define nullable
#endif

#import <Foundation/Foundation.h>
#import "YTVimeoVideo.h"

NS_ASSUME_NONNULL_BEGIN

/**
`YTVimeoExtractorOperation` is a subclass of NSOperation and is used to fetch and parse out information about Vimeo videos. This a low level class. Generally, you should use the higher level `YTVimeoExtractor` class.
*/
Expand All @@ -27,7 +35,7 @@
*
* @return An initialized `YTVimeoExtractorOperation` object.
*/
-(instancetype)initWithVideoIdentifier:(NSString *)videoIdentifier referer:(NSString *)videoReferer;
-(instancetype)initWithVideoIdentifier:(NSString *)videoIdentifier referer:(NSString *_Nullable)videoReferer;
/**
* Creates a new extractor operation with the specified Vimeo video URL and referer.
*
Expand All @@ -37,7 +45,7 @@
* @return An initialized `YTVimeoExtractorOperation` object.
*/

- (instancetype)initWithURL:(NSString *)videoURL referer:(NSString *)videoReferer;
- (instancetype)initWithURL:(NSString *)videoURL referer:(NSString *_Nullable)videoReferer;

/**
* ------------------------------------
Expand All @@ -48,13 +56,15 @@
/**
* Returns a `YTVimeoVideo` object if the operation finished successfully. Otherwise, will be `nil`.
*/
@property (nonatomic, readonly) YTVimeoVideo *operationVideo;
@property (nonatomic, readonly, nullable) YTVimeoVideo *operationVideo;
/**
* The data that the operation parsed out. This value may be nil.
*/
@property (nonatomic, readonly) NSDictionary *jsonDict;
@property (nonatomic, readonly, nullable) NSDictionary *jsonDict;
/**
* Any errors that may have occurred during the operation. Will be `nil` if the operation finished unsuccessfully. Otherwise, will return an error of the `YTVimeoVideoErrorDomain` domain.
*/
@property (nonatomic, readonly) NSError *error;
@property (nonatomic, readonly, nullable) NSError *error;

NS_ASSUME_NONNULL_END
@end
15 changes: 9 additions & 6 deletions YTVimeoExtractor/YTVimeoExtractorOperation.m
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
//
// YTVimeoExtractorOperation.m
// Sample
// YTVimeoExtractor
//
// Created by Soneé Delano John on 11/28/15.
// Copyright © 2015 Louis Larpin. All rights reserved.
//

#import "YTVimeoExtractorOperation.h"
#import "YTVimeoExtractor.h"
#import "YTVimeoVideo.h"
#import "YTVimeoVideo+Private.h"
#import "YTVimeoError.h"



NSString *const YTVimeoURL = @"https://vimeo.com/%@";
NSString *const YTVimeoPlayerConfigURL = @"https://player.vimeo.com/video/%@/config";

Expand Down Expand Up @@ -42,8 +40,11 @@ - (instancetype) init
-(instancetype)initWithVideoIdentifier:(NSString *)videoIdentifier referer:(NSString *)videoReferer{

NSParameterAssert(videoIdentifier);
if (!(self = [super init]))
return nil;

self = [super init];

if (self) {

_videoIdentifier = videoIdentifier;
_vimeoURL = [NSURL URLWithString:[NSString stringWithFormat:YTVimeoPlayerConfigURL, videoIdentifier]];

Expand All @@ -52,6 +53,8 @@ -(instancetype)initWithVideoIdentifier:(NSString *)videoIdentifier referer:(NSSt
_referer = videoReferer;
} else {
_referer = [NSString stringWithFormat:YTVimeoURL, videoIdentifier];
}

}

return self;
Expand Down
2 changes: 1 addition & 1 deletion YTVimeoExtractor/YTVimeoURLParser.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// YTVimeoURLParser.h
// Sample
// YTVimeoExtractor
//
// Created by Soneé Delano John on 12/2/15.
// Copyright © 2015 Louis Larpin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion YTVimeoExtractor/YTVimeoURLParser.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// YTVimeoURLParser.m
// Sample
// YTVimeoExtractor
//
// Created by Soneé Delano John on 12/2/15.
// Copyright © 2015 Louis Larpin. All rights reserved.
Expand Down
35 changes: 35 additions & 0 deletions YTVimeoExtractor/YTVimeoVideo+Private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// YTVimeoVideo+Private.h
// YTVimeoExtractor
//
// Created by Soneé John on 3/15/16.
// Copyright © 2016 Louis Larpin. All rights reserved.
//
#if !__has_feature(nullability)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
#define nullable
#endif

#import "YTVimeoVideo.h"
NS_ASSUME_NONNULL_BEGIN
@interface YTVimeoVideo ()

/**
* Initializes a `YTVimeoVideo` video object with the specified identifier and info.
*
* @param identifier A Vimeo video identifier. This parameter should not be `nil`
* @param info The dictionary that the class will use to parse out the data. This parameter should not be `nil`
*
* @return A newly initialized `YTVimeoVideo` object.
*/
- (instancetype) initWithIdentifier:(NSString *)identifier info:(NSDictionary *)info;
/**
* Starts extracting information about the Vimeo video.
*
* @param completionHandler A block to execute when the extraction process is finished. The completion handler is executed on the main thread. If the completion handler is nil, this method throws an exception.
*/
- (void)extractVideoInfoWithCompletionHandler:(void (^)(NSError *error))completionHandler;

NS_ASSUME_NONNULL_END
@end
Loading

0 comments on commit 44103fb

Please sign in to comment.