About this project
YoutubeKit is a Swift package that helps developers create YouTube applications on Apple platforms. It contains two primary components: YTSwiftyPlayer, a video player built with WKWebView, HTML5, and the YouTube IFrame Player API; and a YoutubeDataAPI client for YouTube Data API v3.
The player supports type-safe embed parameters through VideoEmbedParameter, including video ID, autoplay, inline playback, looping, and related-video controls. Applications can load a local player HTML file and then control playback with methods such as pause, seek, mute, and loading another video by ID. A delegate protocol reports player readiness, playback time changes, state changes, playback-rate changes, errors, quality changes, API readiness, and API loading failures.
The Data API client provides typed request types for resources including activities, captions, channels, channel sections, comments, comment threads, guide categories, playlist items, playlists, search, subscriptions, video abuse report reasons, video categories, and videos. Requests are sent through a shared YoutubeAPI object and return success or failure results. The README shows examples for retrieving video chart data, storing nextPageToken values for pagination, and configuring an API key globally.
For requests that require a signed-in user, the library supports setting an access token; the README notes that Google Sign-In can be used to obtain that token. An example activity request demonstrates retrieving the authenticated user's YouTube activity.
The repository includes an example app demonstrating feed, comment, floating-player, and rotation use cases. Distribution is documented through Swift Package Manager, Carthage, and CocoaPods, with CocoaPods described as deprecated. The documented requirements are Xcode 16 or later and Swift 6 or later. YoutubeKit is released under the MIT license.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.