YouTubePlayerKit A Swift Package to easily play YouTube videos 📺

Overview

logo

YouTubePlayerKit

A Swift Package to easily play YouTube videos

CI status Documentation Platform Twitter

Example application

import SwiftUI
import YouTubePlayerKit

struct ContentView: View {
    
    var body: some View {
        //  WWDC 2019 Keynote
        YouTubePlayerView(
            "https://youtube.com/watch?v=psL_5RIBqnY"
        )
    }
    
}

Features

  • Play YouTube videos with just one line of code 📺
  • YouTube Terms of Service compliant implementation
  • Access to all native YouTube iFrame APIs 👩‍💻 👨‍💻
  • Support for SwiftUI and UIKit 🧑‍🎨
  • Runs on iOS and macOS 📱 🖥
  • async/await support

Example

Check out the example application to see YouTubePlayerKit in action. Simply open the Example/Example.xcodeproj and run the "Example" scheme.

Installation

Swift Package Manager

To integrate using Apple's Swift Package Manager, add the following as a dependency to your Package.swift:

dependencies: [
    .package(url: "https://github.com/SvenTiigi/YouTubePlayerKit.git", from: "1.0.0")
]

Or navigate to your Xcode project then select Swift Packages, click the “+” icon and search for YouTubePlayerKit.

Usage

A YouTube player can be easily rendered when using SwiftUI by declaring a YouTubePlayerView.

import SwiftUI
import YouTubePlayerKit

struct ContentView: View {

    let youTubePlayer: YouTubePlayer = "https://youtube.com/watch?v=psL_5RIBqnY"

    var body: some View {
        YouTubePlayerView(self.youTubePlayer) { state in
            // Overlay ViewBuilder closure to place an overlay View
            // for the current `YouTubePlayer.State`
            switch state {
            case .idle:
                ProgressView()
            case .ready:
                EmptyView()
            case .error(let error):
                Text(verbatim: "YouTube player couldn't be loaded")
            }
        }
    }

}

Check out the additional YouTubePlayerView initializer to place an overlay for a given state.

When using UIKit or AppKit you can make use of the YouTubePlayerViewController.

import UIKit
import YouTubePlayerKit

// Initialize a YouTubePlayer
let youTubePlayer = YouTubePlayer(
    source: .video(id: "psL_5RIBqnY")
)
// Initialize a YouTubePlayerViewController
let youTubePlayerViewController = YouTubePlayerViewController(
    player: youTubePlayer
)

// Example: Access the underlying iFrame API via the `YouTubePlayer` instance
youTubePlayer.getPlaybackMetadata { result in
    switch result {
    case .success(let metadata):
        print("Video title", metadata.title)
    case .failure(let error):
        print("Failed to retrieve metadata", error)
    }
}

// Present YouTubePlayerViewController
self.present(youTubePlayerViewController, animated: true)

YouTubePlayer

A YouTubePlayer is the central object which needs to be passed to every YouTubePlayerView or YouTubePlayerViewController in order to play a certain YouTube video and interact with the underlying YouTube iFrame API.

Therefore, you can easily initialize a YouTubePlayer by using a string literal as seen in the previous examples.

let youTubePlayer: YouTubePlayer = "https://youtube.com/watch?v=psL_5RIBqnY"

A YouTubePlayer generally consist of a YouTubePlayer.Source and a YouTubePlayer.Configuration.

let youTubePlayer = YouTubePlayer(
    source: .video(id: "psL_5RIBqnY"),
    configuration: .init(
        autoPlay: true
    )
)

Source

The YouTubePlayer.Source is a simple enum which allows you to specify which YouTube source should be loaded.

// YouTubePlayer Video Source
let videoSource: YouTubePlayer.Source = .video(id: "psL_5RIBqnY")

// YouTubePlayer Playlist Source
let playlistSource: YouTubePlayer.Source = .playlist(id: "PLHFlHpPjgk72Si7r1kLGt1_aD3aJDu092")

// YouTubePlayer Channel Source
let channelSource: YouTubePlayer.Source = .channel(name: "iJustine")

Additionally, you can use a URL to initialize a YouTubePlayer.Source

let urlSource: YouTubePlayer.Source? = .url("https://youtube.com/watch?v=psL_5RIBqnY")

When using a URL the YouTubePlayer.Source will be optional

Configuration

The YouTubePlayer.Configuration allows you to configure various parameters of the underlying YouTube iFrame player.

let configuration = YouTubePlayer.Configuration(
    // Disable user interaction
    isUserInteractionEnabled: false,
    // Enable auto play
    autoPlay: true,
    // Hide controls
    showControls: false,
    // Enable loop
    loopEnabled: true
)

let youTubePlayer = YouTubePlayer(
    source: "https://youtube.com/watch?v=psL_5RIBqnY",
    configuration: configuration
)

Check out the YouTubePlayer.Configuration to get a list of all available parameters.

API

Additionally, a YouTubePlayer allows you to access the underlying YouTube player iFrame API in order to play, pause, seek or retrieve information like the current playback quality or title of the video that is currently playing.

Check out the YouTubePlayerAPI protocol to get a list of all available functions and properties.

Async/Await

Asynchronous functions on a YouTubePlayer are generally constructed with a completion closure parameter to retrieve the result of the asynchronous operation.

// Retrieve the current PlaybackMetadata via a completion closure
youTubePlayer.getPlaybackMetadata { result in
    switch result {
    case .success(let playbackMetadata):
        print(
            "Title", playbackMetadata.title,
            "Author", playbackMetadata.author
        )
    case .failure(let youTubePlayerAPIError):
        print("Error", youTubePlayerAPIError)
    }
}

On iOS >= 15.0 and macOS >= 12.0 you can use async/await to execute the asynchronous function.

// Retrieve the current PlaybackMetadata
let playbackMetadata = try await youTubePlayer.getPlaybackMetadata()

Playback controls and player settings

// Play video
youTubePlayer.play()

// Pause video
youTubePlayer.pause()

// Stop video
youTubePlayer.stop()

// Seek to 60 seconds
youTubePlayer.seek(to: 60, allowSeekAhead: false)

Events

// A Publisher that emits the current YouTubePlayer State
youTubePlayer.statePublisher

// A Publisher that emits the current YouTubePlayer PlaybackState
youTubePlayer.playbackStatePublisher

// A Publisher that emits the current YouTubePlayer PlaybackQuality
youTubePlayer.playbackQualityPublisher

// A Publisher that emits the current YouTubePlayer PlaybackRate
youTubePlayer.playbackRatePublisher

Playback status

// Retrieve a number between 0 and 1 that specifies the percentage of the video that the player shows as buffered
youTubePlayer.getVideoLoadedFraction { _ in }

// Retrieve the PlaybackState of the player video
youTubePlayer.getPlaybackState { _ in }

// Retrieve the elapsed time in seconds since the video started playing
youTubePlayer.getCurrentTime { _ in }

// Retrieve the current PlaybackMetadata
youTubePlayer.getPlaybackMetadata { _ in }

Load video

// Load a new video from source
youTubePlayer.load(source: .url("https://youtube.com/watch?v=psL_5RIBqnY"))

Update Configuration

// Update the YouTubePlayer Configuration
youTubePlayer.update(
    configuration: .init(
        showControls: false
    )
)

Note: updating the YouTubePlayer.Configuration will result in a reload of the entire YouTubePlayer

Changing the player volume

// Mutes the player
youTubePlayer.mute()

// Unmutes the player
youTubePlayer.unmute()

// Retrieve Bool value if the player is muted
youTubePlayer.isMuted { _ in }

// Retrieve the player's current volume, an integer between 0 and 100
youTubePlayer.getVolume { _ in }

// Sets the volume
youTubePlayer.set(volume: 50)

Retrieving video information

// Retrieve the duration in seconds of the currently playing video
youTubePlayer.getDuration { _ in }

// Retrieve the YouTube.com URL for the currently loaded/playing video
youTubePlayer.getVideoURL { _ in }

// Retrieve the embed code for the currently loaded/playing video
youTubePlayer.getVideoEmbedCode { _ in }

Playing a video in a playlist

// This function loads and plays the next video in the playlist
youTubePlayer.nextVideo()

// This function loads and plays the previous video in the playlist
youTubePlayer.previousVideo()

// This function loads and plays the specified video in the playlist
youTubePlayer.playVideo(at: 3)

// This function indicates whether the video player should continuously play a playlist
youTubePlayer.setLoop(enabled: true)

// This function indicates whether a playlist's videos should be shuffled
youTubePlayer.setShuffle(enabled: true)

// This function returns an array of the video IDs in the playlist as they are currently ordered
youTubePlayer.getPlaylist { _ in }

// This function returns the index of the playlist video that is currently playing
youTubePlayer.getPlaylistIndex { _ in }

Controlling playback of 360° videos

// Retrieves properties that describe the viewer's current perspective
youTubePlayer.get360DegreePerspective { _ in }

// Sets the video orientation for playback of a 360° video
youTubePlayer.set(
    perspective360Degree: .init(
        yaw: 50,
        pitch: 20,
        roll: 60,
        fov: 10
    )
)

Setting the playback rate

// This function retrieves the playback rate of the currently playing video
youTubePlayer.getPlaybackRate { _ in }

// This function sets the suggested playback rate for the current video
youTubePlayer.set(playbackRate: 1.5)

// This function returns the set of playback rates in which the current video is available
youTubePlayer.getAvailablePlaybackRates { _ in }

Credits

License

YouTubePlayerKit
Copyright (c) 2021 Sven Tiigi [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Comments
  • API must be declared unavailable for app extensions

    API must be declared unavailable for app extensions

    YouTubePlayerKit Environment

    • YouTubePlayerKit version: 1.0.0
    • macOS version: 12.0
    • Xcode version: 13.0 beta 4
    • Dependency manager (SPM, Manually): SPM

    What did you do?

    Attempt to add YouTubePlayerKit as a package dependency, and build.

    What did you expect to happen?

    Build cleanly without issue.

    What happened instead?

    There was an error in YouTubePlayerWebView+OpenURL on UIApplication.shared.open(: 'open(_:options:completionHandler:)' is unavailable in application extensions for iOS 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.

    YouTubePlayerKit needs to mark the API as unavailable for app extensions, commensurate with the change in beta 3: https://developer.apple.com/forums/thread/685369

    bug 
    opened by danzool 10
  • Open external links in App context (currently open externally in Safari)

    Open external links in App context (currently open externally in Safari)

    Motivation

    ℹ Please replace this with your motivation. For example if your feature request is related to a problem.

    Ideally I would want to prevent opening external links that are triggered by the player browser - however I understand this goes against YouTube TOS so at least I would prefer to open links inside the apps.

    Solution

    ℹ Please replace this with your proposed solution. Based on this: https://stackoverflow.com/questions/30603671/open-a-wkwebview-target-blank-link-in-safari

    This behavior can be achieved by hooking into WKNavigationDelegate

    However the player web view is private /// The YouTubePlayerWebView private let webView: YouTubePlayerWebView

    The easy option would be making the player view public.

    A more complicated solution would be actually implementing WKNavigationDelegate [https://stackoverflow.com/questions/30603671/open-a-wkwebview-target-blank-link-in-safari]

    override func loadView() { super.loadView() self.webView.navigationDelegate = self self.webView.uiDelegate = self //must have this }

    func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { if navigationAction.targetFrame == nil, let url = navigationAction.request.url { if url.description.lowercased().range(of: "http://") != nil || url.description.lowercased().range(of: "https://") != nil || url.description.lowercased().range(of: "mailto:") != nil { UIApplication.shared.openURL(url) } } return nil }

    Additional context

    ℹ Please replace this with any other context or screenshots about your feature request (optional).

    enhancement 
    opened by erank3 9
  • Blank YouTubePlayerView after return from 2 hours in background

    Blank YouTubePlayerView after return from 2 hours in background

    This bug is similar to my previous bug, but it happens on iPhones as well, not just an iPad in portrait mode. So I think it's more serious.

    I've seen this bug in my own app that uses YouTubePlayerKit, but I figure you'd prefer a repro that uses your own example app.

    I tried a bunch of things to get around the issue, but as you can imagine it takes a while to run each test. I haven't found a work-around that I am sure works yet.

    configuration Xcode 15, iOS 15.0.2, YouTubePlayerKit 1.1.1 Repros on iPad 2018, iPad Mini 2021, iPhone 13 Pro

    Repro steps: Build and install WWDCKeynote app on iPhone Run app Lock screen Wait a couple of hours (Sorry I haven't nailed down the minimum time for this repro. Waiting overnight has always reproduced the issue, I think two hours has also always reproduced the issue.. 30 minutes is usually not enough.) Unlock screen

    Expected: See WWDC video

    Actual: Blank view for the Video, need to force-quit the app to get it to work again

    I can also reproduce this by putting the WWDC app into the background, and doing "stuff" with my phone, such as playing videos in the YouTube app, surfing the web in Safari, and then switching back to the app. But it doesn't always reproduce this way, so it's harder to use it as a test case.

    bug 
    opened by jackpal 7
  • It is possible to specify a xcode version on CI file?

    It is possible to specify a xcode version on CI file?

    Motivation

    Most of real world projects aren't updated so often due a lot of reasons. Some of them could delay almost a year to update their Xcodes. So, to keep the ci running on a macOS-latest machine without specifying the xcode version could be very problematic to this kind of users, since it can change anytime, and from a version to another it could stop working on release step.

    Solution

    Specify a xcode version on CI file; Inform this version on README.md and keep it tracked.

    Additional context

    Maybe count machine upgrades as breaking changes in versioning could be a good move.

    enhancement 
    opened by kobe-pedroveloso 6
  • Fix auto resizing

    Fix auto resizing

    Since the release 1.1.9 the issue #10 which was fixed in release 1.1.4 is now broken due to the commit 4ad4b6312344ab5716178c5c5971637f02022e01 by @lorcanotoole because he deleted window.onresize.

    This PR fix this issue.

    enhancement 
    opened by Tibimac 5
  • YouTubePlayerView usually doesn't resize content vertically.

    YouTubePlayerView usually doesn't resize content vertically.

    YouTubePlayerKit Environment

    • YouTubePlayerKit version: 1.1.3, but issue was seen in earlier versions too.
    • macOS version: 12.0
    • Xcode version: 13.2 beta, but also earlier versions
    • Dependency manager (SPM, Manually): SPM

    What did you do?

    1. Clone https://github.com/jackpal/AmahTV app on an iPad mini (reproduces on simulator iOS 15.0)
    2. git checkout resize-bug
    3. Build and run the app on an iPad. (The first time you do this you will have to update the bundleID and team)
    4. Tap on "Settings" tab to bring up a two-pane UI, where the left pane is a list of channels, and the right pane is a player.
    5. Tap on one of the channels (any one) in the left pane to choose a channel.
    6. If the channel doesn't start playing automatically, tap on the play button.
    7. Tap on the "hide left pane" button in the top left to hide the left panel

    What did you expect to happen?

    I expected the YouTubePlayer to expand to fill the screen.

    What happened instead?

    The YouTubePlayer stays the same size that it was when the left pane was visible.

    This bug reproduces most of the time -- but not always. Once in a while the YouTubePlayer resizes to fill the new space. Seem like it might be a race condition.

    bug 
    opened by jackpal 5
  • No such module 'YouTubePlayerKit'

    No such module 'YouTubePlayerKit'

    YouTubePlayerKit Environment

    • YouTubePlayerKit version: latest version
    • macOS version: BigSur 11.4
    • Xcode version: 13.0
    • Dependency manager (SPM, Manually):

    What did you do?

    Added the package.

    What did you expect to happen?

    ℹ Expected it to be usable.

    What happened instead?

    ℹ No such module 'YouTubePlayerKit'.

    help wanted 
    opened by doriansgithub 5
  • Slow loading videos on macOS

    Slow loading videos on macOS

    YouTubePlayerKit Environment

    • YouTubePlayerKit version: 1.1.12
    • macOS version: 12.6.1
    • Xcode version: 14.0.1
    • Dependency manager (SPM, Manually): SPM

    What did you do?

    ℹ I have a project with two targets, one for iOS and for for macOS. The app lists a grid of thumbnails for the videos. Tapping on a thumbnail will open another view and play the video. When building and running the iOS target videos load very quickly and play. When building the target for macOS and tapping on the thumbnail it takes on average 25 seconds for the videos to load and play.

    What did you expect to happen?

    ℹ I expect the iOS behavior of loading videos to be the same on macOS.

    What happened instead?

    ℹ Videos on macOS take substantially longer to load and play.

    opened by mikem011 4
  • Video carousel with lazyhstack not loading some videos

    Video carousel with lazyhstack not loading some videos

    YouTubePlayerKit Environment

    • YouTubePlayerKit version: 1.2.1
    • macOS version: monterey 12.6
    • Xcode version: 14
    • Dependency manager (SPM, Manually): SPM

    What did you do?

    Video carousel with lazy h stack

    What did you expect to happen?

    A video carousel

    What happened instead?

    Some videos are not loading. If I use a normal HStack it works properly

    Carousel code (ignore the geometry reader, the issue still happens without it)

    //
    //  YoutubePlaylistCarousel.swift
    //  Lartisien
    //
    //  Created by Paul Vasile on 22.09.2022.
    //
    
    import SwiftUI
    import YouTubePlayerKit
    
    struct YoutubePlaylistCarousel: View {
      private let youTubePlayer: YouTubePlayer
      @State private var videoUrls: [String]?
      @State private var scrollPosition: CGFloat = 0
      
      init(playerSource: YouTubePlayer.Source) {
        youTubePlayer = YouTubePlayer(
          source: playerSource,
          configuration: .init(showControls: true, playInline: false, showRelatedVideos: false)
        )
      }
      
      var body: some View {
        ScrollView(.horizontal, showsIndicators: false) {
          ZStack {
            GeometryReader { geometry in
              EmptyView()
                .onChange(of: geometry.frame(in: .named("scroll")).origin.x) { newValue in
                  scrollPosition = newValue
                }
            }
            
            LazyHStack(alignment: .top, spacing: 20) {
              VStack {
                YoutubeCarouselEntry(youTubePlayer: youTubePlayer)
                Text("\(scrollPosition)")
              }
              
              if videoUrls != nil {
                ForEach(videoUrls!, id: \.self) { url in
                  YoutubeCarouselEntry(playerSource: .video(id: url))
                }
              }
            }
            .fixedSize()
          }
        }
        .coordinateSpace(name: "scroll")
        .task {
          await getYoutubeVideoIdsFromPlaylist()
        }
      }
      
      func getYoutubeVideoIdsFromPlaylist() async -> Void {
        do {
          let videoUrls = try await youTubePlayer.getPlaylist()
          
          Task { @MainActor in
            self.videoUrls = videoUrls
            self.videoUrls?.removeFirst()
          }
        } catch {
          print("test: \(error)")
        }
      }
    }
    
    struct YoutubePlaylistCarousel_Previews: PreviewProvider {
      static var previews: some View {
        YoutubePlaylistCarousel(playerSource: .playlist(id: "PLxsIRUJCHXaHNTPW0una0zb3LULFpL8yp"))
      }
    }
    

    Carousel entry code

    //
    //  YoutubeCarouselEntry.swift
    //  Lartisien
    //
    //  Created by Paul Vasile on 22.09.2022.
    //
    
    import SwiftUI
    import YouTubePlayerKit
    
    struct YoutubeCarouselEntry: View {
      private let youTubePlayer: YouTubePlayer
    
      init(playerSource: YouTubePlayer.Source) {
        youTubePlayer = YouTubePlayer(
          source: playerSource,
          configuration: .init(showControls: true, playInline: false, showRelatedVideos: false)
        )
      }
      
      init(youTubePlayer: YouTubePlayer) {
        self.youTubePlayer = youTubePlayer
      }
      
      var body: some View {
        Button(action: {
          youTubePlayer.play()
        }) {
          YouTubePlayerView(youTubePlayer) { state in
            switch state {
              case .idle:
                ProgressView()
              case .ready:
                EmptyView()
                  .frame(width: 200, height: 200)
              case .error(let error):
                Text("test \(error.localizedDescription)")
            }
          }
        }
        .frame(width: 200, height: 200)
        .cornerRadius(Theme.CornerRadius.large.value)
      }
    }
    
    struct YoutubeCarouselEntry_Previews: PreviewProvider {
      static var previews: some View {
        YoutubeCarouselEntry(playerSource: .video(id: "F7YpzD6Ir4o"))
      }
    }
    
    opened by rapgodnpm 4
  • I have a question for app store reviews

    I have a question for app store reviews

    hell guys!

    i try to develop music app about some streamer's with your YouTubePlayerKit and i submit my app to apple store connect but i rejected for the following reasons:

    5.2.3 Audio/Video Downloading: Apps should not facilitate illegal file sharing or include the ability to save, convert, or download media from third-party sources (e.g. Apple Music, YouTube, SoundCloud, Vimeo, etc.) without explicit authorization from those sources. Streaming of audio/video content may also violate Terms of Use, so be sure to check before your app accesses those services. Documentation must be provided upon request.

    Can I pass the screening using your package?

    please give me a advice...

    question 
    opened by yongbeomkwak 4
  • how can i hide pip moe in this library ?

    how can i hide pip moe in this library ?

    Motivation

    ℹ Please replace this with your motivation. For example if your feature request is related to a problem.

    Solution

    ℹ Please replace this with your proposed solution.

    Additional context

    ℹ Please replace this with any other context or screenshots about your feature request (optional). How can i remove pip mode in this Library ?

    question 
    opened by cp-rajvi-p 4
Releases(1.3.0)
  • 1.3.0(Dec 29, 2022)

    What's Changed

    • Improved the player performance by retaining the underlying WKWebView reference directly on an YouTubePlayer instance. Previously the WKWebView instance was retained by the view layer.

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.2.1...1.3.0

    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Aug 30, 2022)

    What's Changed

    • Fixed a bug which causes a compile/archiving error when using < Xcode 13.2.1 https://github.com/SvenTiigi/YouTubePlayerKit/issues/39

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.2.0...1.2.1

    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Jul 24, 2022)

    What's Changed

    • Removed the isUserInteractionEnabled parameter from the YouTubePlayer.Configuration to ensure compliance to the YouTube Terms of Services (https://github.com/SvenTiigi/YouTubePlayerKit/issues/31).
    • Added a openURLAction parameter to the YouTubePlayer.Configuration to allow custom URL handling of opened links from the YouTube Player (https://github.com/SvenTiigi/YouTubePlayerKit/issues/31). The default OpenURLAction will open all links via Safari (UIApplication.shared.open).

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.12...1.2.0

    Source code(tar.gz)
    Source code(zip)
  • 1.1.12(Jun 6, 2022)

    What's Changed

    • Added automaticallyAdjustsContentInsets configuration (https://github.com/SvenTiigi/YouTubePlayerKit/issues/28)

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.11...1.1.12

    Source code(tar.gz)
    Source code(zip)
  • 1.1.11(Apr 24, 2022)

    What's Changed

    • Improved auto resizing of the YouTubePlayer iFrame (https://github.com/SvenTiigi/YouTubePlayerKit/pull/23)

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.10...1.1.11

    Source code(tar.gz)
    Source code(zip)
  • 1.1.10(Apr 21, 2022)

    What's Changed

    • Fixed a bug where a YouTube URL was not correctly parsed via the YouTubePlayer.Source (https://github.com/SvenTiigi/YouTubePlayerKit/issues/24)

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.9...1.1.10

    Source code(tar.gz)
    Source code(zip)
  • 1.1.9(Feb 3, 2022)

    What's Changed

    • Added optional frameObserverDelay to config by @lorcanotoole in https://github.com/SvenTiigi/YouTubePlayerKit/pull/19

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.8...1.1.9

    Source code(tar.gz)
    Source code(zip)
  • 1.1.8(Jan 23, 2022)

    What's Changed

    • Custom user agent added by @lorcanotoole in https://github.com/SvenTiigi/YouTubePlayerKit/pull/18

    New Contributors

    • @lorcanotoole made their first contribution in https://github.com/SvenTiigi/YouTubePlayerKit/pull/18

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.7...1.1.8

    Source code(tar.gz)
    Source code(zip)
  • 1.1.7(Jan 14, 2022)

    What's Changed

    • Fixed a bug where the YouTubePlayer.PlaybackState.ended case was not published correctly.

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.6...1.1.7

    Source code(tar.gz)
    Source code(zip)
  • 1.1.6(Dec 26, 2021)

    What's Changed

    • Removed iOS 15.0 and macOS 12.0 availability checks for Swift Concurrency APIs as Xcode 13.2 and greater allows back deployment of the Swift Concurrency APIs from iOS 13.0 and macOS 10.15

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.5...1.1.6

    Source code(tar.gz)
    Source code(zip)
  • 1.1.5(Dec 8, 2021)

    What's Changed

    • Add host view for presenting outside of a view controller by @dskuza in https://github.com/SvenTiigi/YouTubePlayerKit/pull/15

    New Contributors

    • @dskuza made their first contribution in https://github.com/SvenTiigi/YouTubePlayerKit/pull/15

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.4...1.1.5

    Source code(tar.gz)
    Source code(zip)
  • 1.1.4(Nov 9, 2021)

    What's Changed

    • Fixed a bug where the YouTubePlayer View wasn't resized properly (https://github.com/SvenTiigi/YouTubePlayerKit/issues/10)
    • Refactored player property to be mutable on YouTubePlayerViewController
    • Added App Store Review section to ReadMe (https://github.com/SvenTiigi/YouTubePlayerKit/issues/12)

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.3...1.1.4

    Source code(tar.gz)
    Source code(zip)
  • 1.1.3(Nov 3, 2021)

    What's Changed

    • Improve initialization of some playback subjects by @Tibimac in https://github.com/SvenTiigi/YouTubePlayerKit/pull/7
    • Removed WKScriptMessageHandler and replaced JavaScript Event Callbacks via WKURLNavigation (https://github.com/SvenTiigi/YouTubePlayerKit/issues/4)

    Full Changelog: https://github.com/SvenTiigi/YouTubePlayerKit/compare/1.1.2...1.1.3

    Source code(tar.gz)
    Source code(zip)
  • 1.1.2(Oct 17, 2021)

    What's Changed

    • Fix seek function by @Tibimac in https://github.com/SvenTiigi/YouTubePlayerKit/pull/5
    • Update example application (https://github.com/SvenTiigi/YouTubePlayerKit/issues/3)
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Sep 29, 2021)

    Changes

    • Updating the source of a YouTubePlayer will automatically invoke the load(source:) function
    • Updating the configuration of a YouTubePlayer will automatically invoke the update(configuration:) function
    • Added auto case to YouTubePlayer.PlaybackQuality

    Added

    • showStatsForNerds() function on YouTubePlayerVideoInformationAPI to display advanced statistics about the current YouTubePlayer
    • hideStatsForNerds() function on YouTubePlayerVideoInformationAPI to hide the advanced statistics
    • getInformation(completion:) function on YouTubePlayerVideoInformationAPI to retrieve an object which contains all information about the current YouTubePlayer
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Sep 28, 2021)

    Bug-Fixes

    • Refactored success value for getCurrentTime and getDuration from Int to Double type which previously caused an error when trying to type-cast the JavaScript response value

    Changes

    • Renamed YouTubePlayerLoadAPI to YouTubePlayerQueueingAPI
    • Renamed captionsClosed to showCaptions on YouTubePlayer.Configuration
    • Renamed color to progressBarColor on YouTubePlayer.Configuration
    • Renamed YouTubePlayer.Configuration.Color to YouTubePlayer.Configuration.ProgressBarColor
    • Renamed enableJsAPI to enableJavaScriptAPI on YouTubePlayer.Configuration
    • Renamed modestBranding to useModestBranding on YouTubePlayer.Configuration

    Added

    • cue(source:) function on YouTubePlayerQueueingAPI
    • allowsPictureInPictureMediaPlayback on YouTubePlayer.Configuration to enable or disable Picture-in-Picture mode
    • currentTimePublisher on YouTubePlayerPlaybackAPI
    • videoLoadedFractionPublisher on YouTubePlayerPlaybackAPI
    • playbackMetadataPublisher on YouTubePlayerPlaybackAPI
    • durationPublisher on YouTubePlayerVideoInformationAPI
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Sep 26, 2021)

Owner
Sven Tiigi
iOS Engineer @opwoco
Sven Tiigi
Swift library for embedding and controlling YouTube videos in your iOS applications via WKWebView!

YouTubePlayer Embed and control YouTube videos in your iOS applications! Neato, right? Let's see how it works. 0.7.0 Update: WKWebView breaking change

Giles Van Gruisen 825 Jan 3, 2023
Loop videos on iOS and Android (assuming only one video like on YouTube)

Mobile Video Loop By: Andrew-Chen-Wang iOS Safari Extension (soon Android) that lets you loop a video on your current website. This only works for the

Andrew Chen Wang 0 Dec 19, 2021
A lightweight app to play videos from the Files app in a better (dark) interface which avoids losing your playback position.

Playerly Playerly is a very lightweight Swift app that allows you to select a file (video or movie) from the built in Document Browser, and play it in

Julian Schiavo 28 Dec 3, 2022
Collection of Swift/iOS-related conference videos. A demo project for SuperArc framework - building modular iOS apps with a µComponent architecture.

SwiftCommunity Beta version is available at TestFlight Collection of Swift/iOS-related conference videos. This project serves as a showcase for the Su

SuperArcSwift 52 Dec 2, 2022
The front-end of youtube iOS app developed using swift 5

Youtube-Front-end-iOS The front-end of youtube iOS app developed using swift 5 UIs 1)-The UI that corresponds to Home Tab bar "The first View " The fi

null 1 Nov 28, 2021
MMPlayerView - Custom AVPlayerLayer on view and transition player with good effect like youtube and facebook

MMPlayerView Demo-Swift List / Shrink / Transition / Landscape MMPlayerLayer ex. use when change player view frequently like tableView / collectionVie

Millman Yang 724 Nov 24, 2022
YouTube player for SwiftUI

SwiftUI YouTube Player for iOS and MacOS Fully functional, SwiftUI-ready YouTube player for iOS 14+ and MacOS 11+. Actions and state are both delivere

Gordan Glavaš 12 Dec 25, 2022
reward the user for watching videos to get coins then use them to get rid of annoying admob ads

reward the users for watching youtube videos to the end to earn coins, then use them to get rid of annoying admob ads like banners, interstitial & reward videos

Belal Samy 4 Nov 19, 2021
Lightweight YouTube Downloader for iOS

DownTube DownTube is a very lightweight app that allows you to download any YouTube video for offline use. Note: this app goes against YouTube's TOS a

Adam Boyd 158 Dec 10, 2022
YouTube video player for iOS, tvOS and macOS

About XCDYouTubeKit is a YouTube video player for iOS, tvOS and macOS. Are you enjoying XCDYouTubeKit? You can say thank you with a tweet. I am also a

Cédric Luthi 2.9k Jan 7, 2023
ABMediaView can display images, videos, as well as now GIFs and Audio!

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.

Andrew Boryk 80 Dec 20, 2022
This project is a clone of YouTube. But the main intention is to show how to write clean code, using proper MVC patterns and re-usable coding methodologies!

YouTubeClone This project is a clone of YouTube. But the main intention is to show how to write clean code, using proper MVC patterns and re-usable co

Vamshi Krishna 169 Dec 10, 2022
WatchTube: a standalone WatchOS youtube player utilizing Download API for search data and video streaming

WatchTube is a standalone WatchOS youtube player utilizing Download API for sear

WatchTubeTeam 11 May 30, 2022
📺 A news app using YouTube playlists, built with React Native

NewsWatch-React-Native A YouTube News app for iOS, made with React-Native. Enjoy watching your daily news. Screencast: This project was bootstrapped w

brad oyler 156 Jun 8, 2022
This Google Cast demo app shows how to cast videos from an iOS device in a way that is fully compliant with the Cast Design Checklist.

CastVideos-ios (reference iOS sender app) This Google Cast demo app shows how to cast videos from an iOS device in a way that is fully compliant with

Google Cast 168 Jan 6, 2023
Catalyst example of a grid-based video app that opens videos in secondary windows

Simple Catalyst example (Mac idiom) of a grid-based app populated with videos. On macOS, double-clicking a video opens it in a new playback window. Keyboard navigation is fully supported via the UIKit Focus Engine.

Steven Troughton-Smith 19 Dec 8, 2022
MacTube is a webview wrapper for YouTube for Mac OS.

MacTube MacTube is a webview wrapper for YouTube for Mac OS. It was made for peo

null 33 Dec 26, 2022
A YouTube copy for the Victor Roldan Dev channel

YouTubeClone La idea de la creación de este proyecto, es que tu tengas la oportunidad de ver como es el desarrollo completo de una aplicación, desede

Victor Roldan 11 Dec 27, 2022
Youtube-like double tap to forward/rewind animation with ripple effect.

VideoQuickSeeking Youtube-like double tap to forward/rewind animation with ripple effect. Please feel free to make pull requests. Example To run the e

Hai Pham 3 Dec 7, 2022