Latest 1.1.2
License MIT
Platforms ios 5.0, requires ARC
Frameworks AVFoundation, MediaPlayer


Build Status
Coverage Status
Pod Version
Carthage Compatibility

XCDYouTubeKit is a YouTube video player for iOS, tvOS and OS X.


Are you enjoying XCDYouTubeKit? You can say thank you with a tweet. I am also accepting donations. ;-)

Donate button


  • Runs on iOS 7.0 and later
  • Runs on OS X 10.9 and later


XCDYouTubeKit is against the YouTube Terms of Service. The only official way of playing a YouTube video inside an app is with a web view and the iframe player API. Unfortunately, this is very slow and quite ugly, so I wrote this player to give users a better viewing experience.


XCDYouTubeKit is available through CocoaPods and Carthage.


pod "XCDYouTubeKit", "~> 2.5"


github "0xced/XCDYouTubeKit" ~> 2.5

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:

  1. Create a workspace (File → New → Workspace…)
  2. Add your project to the workspace
  3. Add the XCDYouTubeKit project to the workspace
  4. Drag and drop the libXCDYouTubeKit.a file referenced from XCDYouTubeKit → Products → libXCDYouTubeKit.a into the Link Binary With Libraries build phase of your app’s target.

These steps will ensure that #import <XCDYouTubeKit/XCDYouTubeKit.h> will work properly in your project.


XCDYouTubeKit is fully documented.

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

- (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

XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:@"9bZkp7q19f0"];
[videoPlayerViewController presentInView:self.videoContainerView];
[videoPlayerViewController.moviePlayer play];

iOS and OS X

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
        // Handle error

See the demo project for more sample code.


Since version 2.2.0, XCDYouTubeKit produces logs. XCDYouTubeKit supports CocoaLumberjack but does not require it.

See the XCDYouTubeLogger class documentation for more information.


The URL extraction algorithms in XCDYouTubeKit are inspired by the YouTube extractor module of the youtube-dl project.


Cédric Luthi


XCDYouTubeKit is available under the MIT license. See the LICENSE file for more information.

Latest podspec

    "deprecated_in_favor_of": "XCDYouTubeKit",
    "name": "XCDYouTubeVideoPlayerViewController",
    "version": "1.1.2",
    "summary": "YouTube video player for iPhone and iPad.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Ceu0301dric Luthi": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1.2"
    "platforms": {
        "ios": "5.0"
    "source_files": "XCDYouTubeVideoPlayerViewController",
    "frameworks": [
    "requires_arc": true

Pin It on Pinterest

Share This