Latest 0.8
Homepage https://github.com/131e55/KKPlayerViewController
License MIT
Platforms ios 8.0
Authors

KKPlayerViewController is a video player library written in Swift 3 for easier and more convenient to use AVPlayer.
Support background playback and Picture in Picture.

:sunny: Features

  • Simple API
  • Load video data asynchronously
  • Easily manage playback status
  • Background playback
  • Picture in Picture (iPad, iOS 9.0+)
  • And more

:book: Usage

  1. Create KKPlayerViewController instance.
  2. Add as container view to your view controller. (More info: View Controller Programming Guide for iOS)
  3. Implement KKPlayerViewControllerDelegate.
  4. Load video.
  5. If ready for display, play a video.
class ViewController: UIViewController {

    let url = URL(string:"https://video.twimg.com/ext_tw_video/768701846240104449/pu/vid/720x1280/FW9MWNMhhdKfdygm.mp4")!

    var playerViewController: KKPlayerViewController!

    // viewDidLoad() is an example.
    override func viewDidLoad() {

        super.viewDidLoad()

        // 1.
        self.playerViewController = KKPlayerViewController()

        // 2.
        self.addChildViewController(self.playerViewController)
        self.playerViewController.view.frame = self.view.bounds
        self.view.addSubview(self.playerViewController.view)
        self.playerViewController.didMove(toParentViewController: self)

        // 3.
        self.playerViewController.delegate = self

        // 4.
        self.playerViewController.load(url: url)
    }
}

extension ViewController: KKPlayerViewControllerDelegate {
    func playerViewController(_ playerViewController: KKPlayerViewController, didChangePlayerStatus status: PlayerStatus) {

    }

    func playerViewController(_ playerViewController: KKPlayerViewController, didChangePlaybackStatus status: PlaybackStatus) {

    }

    func playerViewControllerDidReadyForDisplay(_ playerViewController: KKPlayerViewController) {
        // 5.
        playerViewController.play()
    }
}

:cd: Installation

CocoaPods

KKPlayerViewController is available through CocoaPods.

platform :ios, '8.0'
use_frameworks!

target 'YOUR_TARGET_NAME' do
  pod 'KKPlayerViewController'
end

:cat: Author

:jp: Keisuke Kawamura, @131e55

:page_facing_up: License

KKPlayerViewController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "KKPlayerViewController",
    "version": "0.8",
    "summary": "A video player library written in Swift 3 for easier to use AVPlayer. Support background playback and Picture in Picture.",
    "description": "KKPlayerViewController is a video player library written in Swift 3 for easier and more convenient to use AVPlayer.n- Simple APIn- Load video data asynchronouslyn- Easily manage playback statusn- Background playbackn- Picture in Picture (iPad, iOS 9.0+)n- And more",
    "homepage": "https://github.com/131e55/KKPlayerViewController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Keisuke Kawamura": ""
    },
    "source": {
        "git": "https://github.com/131e55/KKPlayerViewController.git",
        "tag": "0.8"
    },
    "social_media_url": "https://twitter.com/131e55",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/**/*.swift",
    "resources": "Resources/*.xib",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This