YoutubeKit alternatives and similar libraries
Based on the "Video" category.
Alternatively, view YoutubeKit alternatives based on common mentions on social networks and blogs.
-
ZFPlayer
Support customization of any player SDK and control layer(支持定制任何播放器SDK和控制层) -
LFLiveKit
LaiFeng IOS Live Kit,H264 and AAC Hard coding,support GPUImage Beauty, rtmp transmission,weak network lost frame,Dynamic switching rate -
MobilePlayer
:iphone: :movie_camera: A powerful and completely customizable media player for iOS -
BMPlayer
A video player for iOS, based on AVPlayer, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles. -
Swift-YouTube-Player
Swift library for embedding and controlling YouTube videos in your iOS applications via WKWebView! -
PryntTrimmerView
A set of tools to trim, crop and select frames inside a video -
VersaPlayer
Versatile Video Player implementation for iOS, macOS, and tvOS -
Periscope VideoViewController
Video view controller with Periscope fast rewind control -
VGPlayer
A simple iOS video player in Swift,Support play local and network,Background playback mode. -
VIMVideoPlayer
Deprecated: Please use [PlayerKit]( https://github.com/vimeo/PlayerKit) instead. -
ios-360-videos
NYT360Video plays 360-degree video streamed from an AVPlayer on iOS. -
AVPlayerViewController-Subtitles
Easy way to show SRT files on AVPlayerViewController -
SSVideoPlayer
A video player that support both local and network resource. -
MPMoviePlayerController-Subtitles
Easy way to show SRT files on MPMoviePlayerController -
AVAnimator
AVAnimator is an iOS library that makes it easy to implement non-trivial animated/video content in iOS -
PlayerView
Player View is a delegated view using AVPlayer of Swift -
swift-360-videos
360 video player for iOS written in swift - a subset of SceneKit that works -
ABMediaView
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos. -
VideoPager
Paging Video UI, and some control components is available. -
JDVideoKit
You can easily transfer your video into Three common video type via this framework.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of YoutubeKit or a related project?
README
YoutubeKit
YoutubeKit
is a video player that fully supports Youtube IFrame API
and YoutubeDataAPI
to easily create Youtube applications.
[
]((https://img.shields.io/badge/Carthage-compatible-brightgreen.svg))
Important Referecens
YoutubeKit
is created based on the following references. If you are unsure whether it is a normal behavior or a bug, please check the following documents first.
Example
This is an app using YoutubeKit
. A simple video playback example is included into Example
.
You can create these functions very easily by using YoutubeKit
.
Example1 | Example2 |
---|---|
![]() |
![]() |
Example3 | Example4 |
![]() |
![]() |
What is YoutubeKit?
YoutubeKit
provides useful functions to create Youtube applications. It consists of the following two functions.
YTSwiftyPlayer (WKWebView + HTML5 + IFrame API)
YoutubeDataAPI
YTSwiftyPlayer
YTSwiftyPlayer
is a video player that supports Youtube IFrame API.
Features:
- High performance (Performance is 30% better than traditional UIWebView based player)
- Low memory impact (maximum 70% off)
- Type safe parameter interface(All IFrame API's parameters are supported as
VideoEmbedParameter
)
YoutubeDataAPI
This library supports YoutubeDataAPI (v3)
. For the details is Here.
Available API lists:
- Actitivty(list)
- Actitivty(insert)
- Caption(list)
- Channel(list)
- ChannelSections(list)
- Comment(list)
- CommentThreads(list)
- GuideCategories(list)
- PlaylistItems(list)
- Playlists(list)
- Search(list)
- Subscriptions(list)
- VideoAbuseReportReasons(list)
- VideoCategories(list)
- Videos(list)
Get Started
Playback the youtube video.
import YoutubeKit
final class VideoPlayerController: UIViewController {
private var player: YTSwiftyPlayer!
override func viewDidLoad() {
super.viewDidLoad()
// Create a new player
player = YTSwiftyPlayer(
frame: .zero,
playerVars: [
.playsInline(false),
.videoID("9AALILYu58w"),
.loopVideo(true),
.showRelatedVideo(false),
.autoplay(true)
])
view = player
player.delegate = self
// Load video player
let playerPath = Bundle(for: ViewController.self).path(forResource: "player", ofType: "html")!
let htmlString = try! String(contentsOfFile: playerPath, encoding: .utf8)
player.loadPlayerHTML(htmlString)
}
}
YTSwiftyPlayerDelegate
YTSwiftyPlayerDelegate
supports folowing delegate methods.
func playerReady(_ player: YTSwiftyPlayer)
func player(_ player: YTSwiftyPlayer, didUpdateCurrentTime currentTime: Double)
func player(_ player: YTSwiftyPlayer, didChangeState state: YTSwiftyPlayerState)
func player(_ player: YTSwiftyPlayer, didChangePlaybackRate playbackRate: Double)
func player(_ player: YTSwiftyPlayer, didReceiveError error: YTSwiftyPlayerError)
func player(_ player: YTSwiftyPlayer, didChangeQuality quality: YTSwiftyVideoQuality)
func apiDidChange(_ player: YTSwiftyPlayer)
func youtubeIframeAPIReady(_ player: YTSwiftyPlayer)
func youtubeIframeAPIFailedToLoad(_ player: YTSwiftyPlayer)
Call IFrame API during playback.
// Pause the video.
player.pauseVideo()
// Seek after 15 seconds.
player.seek(to: 15, allowSeekAhead: true)
// Set a mute.
player.mute()
// Load another video.
player.loadVideo(videoID: "abcde")
Get video information using YoutubeDataAPI
First, Get API key from Here.
Next, add this code in your AppDelegate.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Set your API key here
YoutubeKit.shared.setAPIKey("Your API key")
return true
}
And then you can use YoutubeDataAPI
request like this.
// Get youtube chart ranking
let request = VideoListRequest(part: [.id, .statistics], filter: .chart)
// Send a request.
ApiSession.shared.send(request) { result in
switch result {
case .success(let response):
print(response)
case .failed(let error):
print(error)
}
}
Example of response here.
VideoList(items: [YoutubeKit.Video(etag: "\"A8kisgyDEbllhHF9ooXPFFrkc/nR6_A9oyIoLTJuucY_UXeasjYNU\"",
kind: "youtube#video",
id: "jeiDjeJgF0",
contentDetails: nil,
statistics: Optional(YoutubeKit.Statistics.VideoList(dislikeCount: "1631", likeCount: "60307", commentCount: Optional("8675"), favoriteCount: "0", viewCount: "1259046")),
snippet: nil,
status: nil),
etag: "\"J67fSnfblalhHF0foXPiFFrkc/TZGPJdE22-LilSv4-3VNoPw1cS4\"",
kind: "youtube#videoListResponse",
pageInfo: YoutubeKit.PageInfo(resultsPerPage: 5, totalResults: 200))
Fetch the next page (Pagination)
var nextPageToken: String?
...
// Send some request
ApiSession.shared.send(request) { [weak self] result in
switch result {
case .success(let response):
// Save nextPageToken
self?.nextPage = response.nextPageToken
case .failed(let error):
print(error)
}
}
...
// Set nextPageToken
let request = VideoListRequest(part: [.id], filter: .chart, nextPageToken: nextPageToken)
Authorization Request
If you want authorized request such as a getting your activity in Youtube, you set your access token before sending a request.
To use GoogleSignIn
, you can easily get your access token.
pod 'GoogleSignIn'
First, add this code in your AppDelegate.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Set your access token for autheticate request
YoutubeKit.shared.setAccessToken("Your access token")
return true
}
And then you can use request requiring authorization, this is an example to get your Youtube activity.
// Get your Youtube activity
let request = ActivityListRequest(part: [.snippet], filter: .mine(true))
// Send a request.
ApiSession.shared.send(request) { result in
switch result {
case .success(let video):
print(video)
case .failed(let error):
print(error)
}
}
Requirements
XCode 11+
Swift 5+
Installation
Cocoapods
$ pod repo update
And add this to your Podfile:
pod 'YoutubeKit'
and
$ pod install
Carthage
Add this to your Cartfile:
github "rinov/YoutubeKit"
and
$ carthage update
Author
Github: https://github.com/rinov
Twitter: https://twitter.com/rinov0321
Email: rinov[at]rinov.jp
License
YoutubeKit is available under the MIT license.
*Note that all licence references and agreements mentioned in the YoutubeKit README section above
are relevant to that project's source code only.