• Stars
    star
    527
  • Rank 81,011 (Top 2 %)
  • Language
    Objective-C
  • Created almost 12 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A MPMoviePlayerViewController subclass that can display YouTube videos.

IMPORTANT

LBYouTubeView has been discontinued. I won't fix any issues anymore. Although this approach fixes a couple of issues, it does not work reliably enough. Check out XCDYouTubeVideoPlayerViewController. It's similar to this project but seems to work better as its way of extracting the video URL is less hacky.

LBYouTubeView

About

LBYouTubeView is just a small view that is able to display YouTube videos in a MPMoviePlayerController. You even have the choice between high-quality and standard quality stream.

How does it work? It just loads the HTML code of YouTube's mobile website and looks for the data in the script tag. LBYouTubeView doesn't use UIWebView which makes it faster and look cleaner.

Usage

LBYouTubeView is dead simple. Just add an instance as a subview to a UIViewControllers view and tell it, what video it should load.

Installation

  1. Drag the LBYouTubeView folder into your project.
  2. Import the MediaPlayer.framework.
  3. If you need to support iOS 4, add JSONKit to your project and set -fno-objc-arc compiler flag to JSONKit.m.

Example

LBYouTubePlayerViewController* controller = [[LBYouTubePlayerViewController alloc] initWithYouTubeURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=1fTIhC1WSew&list=FLEYfH4kbq85W_CiOTuSjf8w&feature=mh_lolz"] quality:LBYouTubeVideoQualityLarge];
controller.delegate = self;
controller.view.frame = CGRectMake(0.0f, 0.0f, 200.0f, 200.0f);
controller.view.center = self.view.center;
[self.view addSubview:self.controller.view];

You can also only extract video URL without to use LBYouTubePlayerViewController directly:

LBYouTubeExtractor* extractor = [[LBYouTubeExtractor alloc] initWithURL:URL quality:quality];
extractor.delegate = self;
[extractor startExtracting];

Requirements

LBYouTubeView requires iOS 4. Also, it is deployed for an ARC environment.

License

LBYouTubeView is licensed under the MIT License.

YouTube EULA

As stated in Google's Monetization Guidelines that attempting to play a YouTube video outside of either the YouTube embedded, custom or chromeless player is strictly prohibited by the API Terms of Service. LBYouTubeView most likely does violate those guidelines. However, it seems like Apple lets your app pass through their review. Anyway, use it on your own risk.

More Repositories

1

ImagePickerSheetController

ImagePickerSheetController replicates the custom photo action sheet in iMessage.
Swift
1,450
star
2

nuage-macos

A native SoundCloud app for macOS, written in SwiftUI
Swift
298
star
3

LBGIFImage

This is a small category that creates an animated UIImage out of a gif image.
Objective-C
174
star
4

StackNavigationView

A SwiftUI component for macOS that makes complex view hierarchies possible
Swift
106
star
5

LBProgressBar

This is a custom subclass of NSProgressIndicator designed by Orman Clark (http://www.premiumpixels.com/)
Objective-C
87
star
6

LBGradient

NSGradient for iOS
Objective-C
68
star
7

ImagePickerTrayController

The iOS 10 version of ImagePickerSheetController
Swift
68
star
8

LBActionSheet

A very customizable drop-in replacement for UIActionSheet
Objective-C
47
star
9

LBAudioDetective

An audio fingerprinting library to compare audio signals
Objective-C
40
star
10

LBSegmentedButton

This is a twitter-like button.
Objective-C
29
star
11

SoundCloud

The private SoundCloud API v2 in Swift
Swift
25
star
12

MuseumGuide

A small framework that makes UIImage accessible
Swift
22
star
13

Sweets

A framework that extends UIKit so that it's somewhat convenient to use with Swift
Swift
16
star
14

ethz-summaries-b15

Cheat Sheets und Zusammenfassungen Basisjahr D-INFK 2015/16 ETHZ
TeX
12
star
15

spotit

Python
8
star
16

SearchField

A GitHub-like search field for SwiftUI.
Swift
8
star
17

alexandria-extension

A browser extension for academic papers
TypeScript
8
star
18

swift-stm

An optimistic STM written in Swift
Swift
6
star
19

Scholarship

iPad app that I use as a resume to apply for scholarships.
Swift
5
star
20

wink

A little script that takes a picture when you wink
Python
4
star
21

RetainCarousel

This is a small category that helps you finding retain cycles.
Objective-C
4
star
22

Blog

Source code for my blog posts
Objective-C
3
star
23

HackZurich

Objective-C
2
star
24

Spectral

A Β΅framework that adds hex support to UIColor/NSColor
Swift
2
star
25

AtomicLinkedList

A lazy, lock-free linked list
Swift
2
star
26

nutshell-macos

An AI-powered note-taking app for your meetings. Built for macOS using SwiftUI.
Swift
1
star
27

poly

🌈 poly - a crowd-sourced and AI-assisted localization tool
Rust
1
star
28

hotkeyd

Simple and hackable global keyboard shortcuts for macOS.
Rust
1
star