Latest 0.7.0
Homepage https://github.com/piemonte/player
License MIT
Platforms ios 8.0, tvos 9.0, requires ARC
Authors

Player

Player

Player is a simple iOS video player library written in Swift.

Build Status Pod Version Swift Version GitHub license

Features

  • [x] plays local media or streams remote media over HTTP
  • [x] customizable UI and user interaction
  • [x] no size restrictions
  • [x] orientation change support
  • [x] simple API

Quick Start

Player is available for installation using the Cocoa dependency manager CocoaPods. Alternatively, you can simply copy the Player.swift file into your Xcode project.

Xcode 8 & Swift 3

# CocoaPods
swift_version = "3.0"
pod "Player", "~> 0.5.0"

# Carthage
github "piemonte/Player" ~> 0.5.0

Usage

The sample project provides an example of how to integrate Player, otherwise you can follow these steps.

Allocate and add the Player controller to your view hierarchy.

 self.player = Player()
 self.player.playerDelegate = self
 self.player.playbackDelegate = self
 self.player.view.frame = self.view.bounds

 self.addChildViewController(self.player)
 self.view.addSubview(self.player.view)
 self.player.didMoveToParentViewController(self)

Provide the file path to the resource you would like to play locally or stream. Ensure you’re including the file extension.

let videoUrl: NSURL = // file or http url
self.player.setUrl(videoUrl)

play/pause/chill

 self.player.playFromBeginning()

Adjust the fill mode for the video, if needed.

 self.player.fillMode = FillMode.resizeAspectFit

Display video playback progress, if needed.

extension ViewController: PlayerPlaybackDelegate {

    public func playerPlaybackWillStartFromBeginning(_ player: Player) {
    }

    public func playerPlaybackDidEnd(_ player: Player) {
    }

    public func playerCurrentTimeDidChange(_ player: Player) {
        let fraction = Double(player.currentTime) / Double(player.maximumDuration)
        self._playbackViewController?.setProgress(progress: CGFloat(fraction), animated: true)
    }

    public func playerPlaybackWillLoop(_ player: Player) {
        self. _playbackViewController?.reset()
    }

}

Documentation

You can find the docs here. Documentation is generated with jazzy and hosted on GitHub-Pages.

Community

Resources

License

Player is available under the MIT license, see the LICENSE file for more information.

Latest podspec

{
    "name": "Player_iOS8",
    "version": "0.7.0",
    "license": "MIT",
    "summary": "video player in Swift, simple way to play and stream media in your iOS or tvOS app",
    "homepage": "https://github.com/piemonte/player",
    "social_media_url": "http://twitter.com/piemonte",
    "authors": {
        "patrick piemonte": "[email protected]"
    },
    "source": {
        "git": "https://github.com/iShawnWang/Player.git",
        "tag": "0.7.0"
    },
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This