Advanced usage with YTPlayerViewDelegate
masterFor more complex implementations, such as passing additional player parameters or handling player events (callbacks), implement the
YTPlayerViewDelegate protocol.repository·master·Indexed 23 days ago
https://github.com/youtube/youtube-ios-player-helperA library for iOS developers to embed and control YouTube videos within applications using the YTPlayerView component. Supports installation via CocoaPods and Swift Package Manager, and provides the YTPlayerViewDelegate protocol for handling player events and advanced parameters.
YTPlayerViewDelegate protocol.To use Swift Package Manager, add the repository URL to your Package.swift dependencies and include YouTubeiOSPlayerHelper in your target's dependencies.
// Add to dependencies
.package("https://github.com/youtube/youtube-ios-player-helper.git", from: "x.y.z")
// Add to target
.target(name: "TargetName",
dependencies: [
"YouTubeiOSPlayerHelper"
]
)Add the following line to your Podfile, replacing x.y.z with the latest version to install the library using CocoaPods.
pod "youtube-ios-player-helper", "~> x.y.z"Follow these steps to integrate the player into your iOS application using Storyboards and Objective-C:
UIView of your desired size onto your Storyboard.YTPlayerView.#import "YTPlayerView.h".IBOutlet for the player in your ViewController's header file:@property(nonatomic, strong) IBOutlet YTPlayerView *playerView;[self.playerView loadWithVideoId:@