Skip to content

Commit

Permalink
Merge branch 'release/2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Nov 25, 2015
2 parents 493aeca + 8e1785c commit ae7af79
Show file tree
Hide file tree
Showing 802 changed files with 44,997 additions and 2,388 deletions.
42 changes: 23 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
osx_image: xcode6.4
osx_image: xcode7.1
language: objective-c
env:
global:
LC_CTYPE="en_US.UTF-8"
matrix:
- CONFIGURATION="Code Coverage" SCHEME="XCDYouTubeKit iOS Static Library" DESTINATION="platform=iOS Simulator,name=iPhone 5s" OBJROOT="build"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.1"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.2"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.3"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.4"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" DESTINATION="platform=iOS Simulator,name=iPhone 4s" RUN_CLANG_STATIC_ANALYZER="YES"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" DESTINATION="platform=iOS Simulator,name=iPhone 5s" RUN_CLANG_STATIC_ANALYZER="YES"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" DESTINATION="platform=iOS Simulator,name=iPhone 4s" RUN_CLANG_STATIC_ANALYZER="YES"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" DESTINATION="platform=iOS Simulator,name=iPhone 5s" RUN_CLANG_STATIC_ANALYZER="YES"
- CONFIGURATION="Release" SCHEME="XCDYouTubeKit OS X" DESTINATION="platform=OS X" RUN_CLANG_STATIC_ANALYZER="YES"
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Code Coverage" SCHEME="XCDYouTubeKit iOS Static Library" OBJROOT="build"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.1" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.2" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.3" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.4" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.0" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.1" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.1" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" IPHONEOS_DEPLOYMENT_TARGET="9.1"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 4s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 4s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=OS X" CONFIGURATION="Release" SCHEME="XCDYouTubeKit OS X" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=OS X" CONFIGURATION="Release" SCHEME="XCDYouTubeKit OS X" MACOSX_DEPLOYMENT_TARGET="10.10"'
- 'DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p" CONFIGURATION="Release" SCHEME="XCDYouTubeKit tvOS" RUN_CLANG_STATIC_ANALYZER="YES"'
before_install:
- xcrun simctl list
install:
- brew update; brew update
- brew install coreutils
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty-travis-formatter --no-rdoc --no-ri --no-document --quiet
- sudo easy_install cpp-coveralls
script:
- open -b com.apple.iphonesimulator # Workaround https://github.com/travis-ci/travis-ci/issues/3040
- ./Scripts/run-tests.sh
after_success:
- if [ "$CONFIGURATION" == "Code Coverage" ]; then
coveralls --include XCDYouTubeKit;
fi
- '[ "$CONFIGURATION" == "Code Coverage" ] && coveralls --include XCDYouTubeKit'
after_failure:
- cat xcodebuild.log
- cat $TMPDIR/com.apple.dt.XCTest-status/Session*.log
- cat ~/Library/Logs/DiagnosticReports/xctest*.crash
- sleep 5
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### Version 2.4.0

* Support for tvOS. (#182)
* Replaced deprecated methods and classes: now using `NSURLSession` instead of `NSURLConnection` internally. (#190, #210)
* Support for Objective-C generics where applicable.
* The `XCDYouTubeVideoOperation` class has changed back from a synchronous to an asynchronous operation and can be started on the main thread.

#### Version 2.3.3

* Adaptation to YouTube API change. (#193, #194, #196, #197, #198, #202)
Expand Down
60 changes: 39 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Coverage Status](https://img.shields.io/coveralls/0xced/XCDYouTubeKit/master.svg?style=flat)](https://coveralls.io/r/0xced/XCDYouTubeKit?branch=master)
[![Platform](https://img.shields.io/cocoapods/p/XCDYouTubeKit.svg?style=flat)](http://cocoadocs.org/docsets/XCDYouTubeKit/)
[![Pod Version](https://img.shields.io/cocoapods/v/XCDYouTubeKit.svg?style=flat)](https://cocoapods.org/pods/XCDYouTubeKit)
[![Carthage Compatibility](https://img.shields.io/badge/carthage-✓-f2a77e.svg?style=flat)](https://github.com/Carthage/Carthage/)
[![Carthage Compatibility](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage/)
[![License](https://img.shields.io/cocoapods/l/XCDYouTubeKit.svg?style=flat)](LICENSE)

**XCDYouTubeKit** is a YouTube video player for iOS and OS X.
Expand All @@ -29,13 +29,15 @@ XCDYouTubeKit is against the YouTube [Terms of Service](https://www.youtube.com/
XCDYouTubeKit is available through CocoaPods and Carthage.

CocoaPods:

```ruby
pod "XCDYouTubeKit", "~> 2.3.3"
pod "XCDYouTubeKit", "~> 2.4.0"
```

Carthage:

```objc
github "0xced/XCDYouTubeKit" ~> 2.3.3
github "0xced/XCDYouTubeKit" ~> 2.4.0
```

Alternatively, you can manually use the provided static library on iOS or dynamic framework on OS X. In order to use the iOS static library, you must:
Expand All @@ -51,31 +53,31 @@ These steps will ensure that `#import <XCDYouTubeKit/XCDYouTubeKit.h>` will work

XCDYouTubeKit is [fully documented](http://cocoadocs.org/docsets/XCDYouTubeKit/).

### iOS and OS X

```objc
NSString *videoIdentifier = @"EdeVaT-zZt4"; // A 11 characters YouTube video identifier
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:videoIdentifier completionHandler:^(XCDYouTubeVideo *video, NSError *error) {
if (video)
{
// Do something with the `video` object
}
else
{
// Handle error
}
}];
```
### iOS only

On iOS, you can use the class `XCDYouTubeVideoPlayerViewController` the same way you use a `MPMoviePlayerViewController`, except you initialize it with a YouTube video identifier instead of a content URL.

#### Present the video in full-screen

```objc
XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:@"9bZkp7q19f0"];
[self presentMoviePlayerViewControllerAnimated:videoPlayerViewController];
- (void) playVideo
{
XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:@"9bZkp7q19f0"];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerPlaybackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:videoPlayerViewController.moviePlayer];
[self presentMoviePlayerViewControllerAnimated:videoPlayerViewController];
}

- (void) moviePlayerPlaybackDidFinish:(NSNotification *)notification
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:notification.object];
MPMovieFinishReason finishReason = [notification.userInfo[MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] integerValue];
if (finishReason == MPMovieFinishReasonPlaybackError)
{
NSError *error = notification.userInfo[XCDMoviePlayerPlaybackDidFinishErrorUserInfoKey];
// Handle error
}
}

```

#### Present the video in a non full-screen view
Expand All @@ -86,6 +88,22 @@ XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVid
[videoPlayerViewController.moviePlayer play];
```
### iOS and OS X
```objc
NSString *videoIdentifier = @"EdeVaT-zZt4"; // A 11 characters YouTube video identifier
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:videoIdentifier completionHandler:^(XCDYouTubeVideo *video, NSError *error) {
if (video)
{
// Do something with the `video` object
}
else
{
// Handle error
}
}];
```

See the demo project for more sample code.

## Logging
Expand Down
13 changes: 6 additions & 7 deletions Scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ set -o pipefail
: ${CONFIGURATION:="Release"}
: ${DESTINATION:="platform=iOS Simulator,name=iPhone 5s"}

COMMAND=""
gstdbuf --version > /dev/null && COMMAND+="gstdbuf -o 0 "
COMMAND+="xcodebuild clean test -project XCDYouTubeKit.xcodeproj -scheme '${SCHEME}' -configuration '${CONFIGURATION}' -destination '${DESTINATION}'"
COMMAND="env NSUnbufferedIO=YES xcodebuild clean test -project XCDYouTubeKit.xcodeproj -scheme '${SCHEME}' -configuration '${CONFIGURATION}' -destination '${DESTINATION}'"

for BUILD_SETTING in OBJROOT RUN_CLANG_STATIC_ANALYZER; do
for BUILD_SETTING in OBJROOT RUN_CLANG_STATIC_ANALYZER IPHONEOS_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET; do
VALUE=`eval echo \\$"${BUILD_SETTING}"`
if [ ! -z "${VALUE}" ]; then
COMMAND+=" ${BUILD_SETTING}='${VALUE}'"
unset ${BUILD_SETTING}
fi
done

xcpretty --version > /dev/null && COMMAND+=" | xcpretty -c"
xcpretty-travis-formatter > /dev/null && COMMAND+=" -f `xcpretty-travis-formatter`"
COMMAND+=" | tee xcodebuild.log"

xcpretty --version > /dev/null 2>&1 && COMMAND+=" | xcpretty -c" && xcpretty-travis-formatter > /dev/null 2>&1 && COMMAND+=" -f `xcpretty-travis-formatter`"

set -x
eval "${COMMAND}"
eval "${COMMAND}" && rm xcodebuild.log
2 changes: 1 addition & 1 deletion XCDYouTubeKit Demo/OS X Demo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ @implementation AppDelegate

- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
{
[[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"VideoIdentifier": @"EdeVaT-zZt4" }];
[[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"VideoIdentifier": @"6v2L2UGZJAM" }];

[DDLog addLogger:[DDASLLogger sharedInstance]];
}
Expand Down
22 changes: 12 additions & 10 deletions XCDYouTubeKit Demo/OS X Demo/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.AVKitIBPlugin" version="5056"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.AVKitIBPlugin" version="9060"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand All @@ -11,7 +12,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
<connections>
<outlet property="playerView" destination="RLu-Rh-Nir" id="5o6-eQ-dlI"/>
Expand Down Expand Up @@ -672,23 +673,22 @@
<window title="XCDYouTubeKit Demo" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" miniaturizable="YES" resizable="YES" texturedBackground="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="315"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<value key="minSize" type="size" width="480" height="315"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="315"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<avPlayerView controlsStyle="floating" translatesAutoresizingMaskIntoConstraints="NO" id="RLu-Rh-Nir">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
</avPlayerView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="3Ti-hx-6zd">
<rect key="frame" x="55" y="282" width="370" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sne-eH-5TO">
<rect key="frame" x="0.0" y="2" width="168" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="YouTube Video Identifier:" id="lX0-jm-7GA">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -697,7 +697,7 @@
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ISA-uQ-Y9T">
<rect key="frame" x="174" y="0.0" width="164" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" drawsBackground="YES" id="Y6N-pz-daO">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -711,13 +711,14 @@
</textField>
<progressIndicator horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="SO3-xf-1sf">
<rect key="frame" x="346" y="3" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
</progressIndicator>
</subviews>
<constraints>
<constraint firstAttribute="width" constant="370" id="mUr-id-ECh"/>
<constraint firstAttribute="height" constant="22" id="nmU-YV-9SM"/>
</constraints>
<animations/>
</customView>
</subviews>
<constraints>
Expand All @@ -728,6 +729,7 @@
<constraint firstAttribute="centerX" secondItem="3Ti-hx-6zd" secondAttribute="centerX" id="iak-7l-sut"/>
<constraint firstItem="RLu-Rh-Nir" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="k1u-xQ-Az3"/>
</constraints>
<animations/>
</view>
</window>
<userDefaultsController representsSharedInstance="YES" id="4NX-h0-LSt"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>ch.pitaya.xcdyoutubekit.demo.osx</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
6 changes: 6 additions & 0 deletions XCDYouTubeKit Demo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ target 'XCDYouTubeKit OS X Demo' do
platform :osx, '10.9'
import_pods
end

target 'XCDYouTubeKit tvOS Demo' do
plugin 'cocoapods-expert-difficulty'
platform :tvos, '9.0'
pod 'Google-API-Client/YouTube', '~> 1.0.422'
end
16 changes: 15 additions & 1 deletion XCDYouTubeKit Demo/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ PODS:
- CocoaLumberjack/Core
- CocoaLumberjack/Extensions (2.0.1):
- CocoaLumberjack/Default
- Google-API-Client/Common (1.0.422):
- gtm-http-fetcher (~> 1.0.141)
- gtm-oauth2 (~> 1.0.125)
- Google-API-Client/YouTube (1.0.422):
- Google-API-Client/Common
- gtm-http-fetcher (~> 1.0.141)
- gtm-oauth2 (~> 1.0.125)
- gtm-http-fetcher (1.0.141)
- gtm-oauth2 (1.0.126):
- gtm-http-fetcher (~> 1.0.141)
- NSLogger (1.5.1):
- NSLogger/Standard (= 1.5.1)
- NSLogger/Standard (1.5.1)
Expand All @@ -15,11 +25,15 @@ PODS:
- NSLogger (~> 1.5.1)

DEPENDENCIES:
- Google-API-Client/YouTube (~> 1.0.422)
- XCDLumberjackNSLogger (~> 1.0.0)

SPEC CHECKSUMS:
CocoaLumberjack: 019d1361244274a6138c788c6cb80baabc13fb8f
Google-API-Client: cb712cf122f1d7fda966de4c2bc551324573366c
gtm-http-fetcher: 6d4617e7d343b6e4c082b777541c334eb6f5d81e
gtm-oauth2: 2a18b824e4f8a02df6cfe987beb59ae9d9697f9d
NSLogger: 5ed223a2436df96244e033be750656dacdeec034
XCDLumberjackNSLogger: 867392d7b40490e1b15aac9c1acee0952bf33d61

COCOAPODS: 0.38.2
COCOAPODS: 0.39.0

0 comments on commit ae7af79

Please sign in to comment.