XCDYouTubeKit

Description

XCDYouTubeKit is a popular open-source Objective-C library that allows you to easily integrate YouTube video playback and downloading capabilities into your iOS applications. It provides a simple and intuitive API for interacting with YouTube videos, handling video playback, and extracting video metadata.

Installation

To add XCDYouTubeKit to your project, follow these steps:

  1. Open your project in Xcode.
  2. Go to the File menu and select Swift Packages and then Add Package Dependency.
  3. Enter the following repository URL: https://github.com/0xced/XCDYouTubeKit.git
  4. Select the appropriate version or branch you want to use and click Next.
  5. Choose the target where you want to add XCDYouTubeKit and click Finish.

Usage

To use XCDYouTubeKit in your application, follow these steps:

  1. Import the XCDYouTubeKit module:
  2. // Swift
    import XCDYouTubeKit
        
    // Objective-C
    @import XCDYouTubeKit;
  3. Create an instance of XCDYouTubeVideoPlayerViewController:
  4. // Swift
    let videoPlayerViewController = XCDYouTubeVideoPlayerViewController(videoIdentifier: "VIDEO_ID")
        
    // Objective-C
    XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:@"VIDEO_ID"];
  5. Present or push the view controller to display the video player:
  6. // Swift
    present(videoPlayerViewController, animated: true, completion: nil)
        
    // Objective-C
    [self presentViewController:videoPlayerViewController animated:YES completion:nil];
  7. To extract video metadata, use the XCDYouTubeClient class:
  8. // Swift
    XCDYouTubeClient.default().getVideoWithIdentifier("VIDEO_ID") { (video, error) in
        if let video = video {
            // Use video object here
        } else if let error = error {
            // Handle error here
        }
    }
        
    // Objective-C
    [[XCDYouTubeClient defaultClient] getVideoWithIdentifier:@"VIDEO_ID" completionHandler:^(XCDYouTubeVideo * _Nullable video, NSError * _Nullable error) {
        if (video) {
            // Use video object here
        } else if (error) {
            // Handle error here
        }
    }];

Additional Features

The XCDYouTubeKit library also provides additional features and functionality, including:

  • Downloading YouTube videos
  • Handling YouTube playlists
  • Accessing closed captions and subtitles
  • Customizing the video player interface
  • And much more! Refer to the official XCDYouTubeKit GitHub repository for detailed documentation and examples.

Requirements

XCDYouTubeKit has the following requirements:

  • iOS 10.0 or later
  • Xcode 10.2 or later
  • Swift 4.2 or later
  • Objective-C

Conclusion

XCDYouTubeKit is a powerful and user-friendly library for integrating YouTube video playback and downloading capabilities into your iOS applications. With its easy-to-use API and extensive features, you can provide a seamless and immersive video experience for your users.

We hope this documentation helps you get started with XCDYouTubeKit. For more information, refer to the official XCDYouTubeKit GitHub repository and the provided examples. Happy coding!