Skip to content
/ Player Public
forked from piemonte/Player

▶️ video player in Swift, simple way to play and stream media on iOS/tvOS

License

Notifications You must be signed in to change notification settings

Sierrin/Player

This branch is 19 commits behind piemonte/Player:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e00c832 · Jun 6, 2020
Aug 5, 2018
Jan 12, 2020
Jan 12, 2020
Sep 5, 2018
Aug 9, 2016
Mar 27, 2019
Jun 6, 2020
Nov 27, 2014
Sep 18, 2019
Mar 5, 2015
Nov 21, 2019
Nov 21, 2019
Feb 3, 2017

Repository files navigation

Player

Player

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

Build Status Pod Version Swift Version GitHub license

Need a different version of Swift?

  • 5.0 - Target your Podfile to the latest release or master
  • 4.2 - Target your Podfile to the swift4.2 branch
  • 4.0 - Target your Podfile to the swift4.0 branch

Features

  • plays local media or streams remote media over HTTP
  • customizable UI and user interaction
  • no size restrictions
  • orientation change support
  • simple API
  • video frame snapshot support

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.

# CocoaPods
pod "Player", "~> 0.13.2"

# Carthage
github "piemonte/Player" ~> 0.13.2

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.addChild(self.player)
 self.view.addSubview(self.player.view)
 self.player.didMove(toParent: 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: URL = // file or http url
self.player.url = videoUrl

play/pause

 self.player.playFromBeginning()

Adjust the fill mode for the video, if needed.

 self.player.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.

About

▶️ video player in Swift, simple way to play and stream media on iOS/tvOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 94.6%
  • Objective-C 3.1%
  • Ruby 1.4%
  • Shell 0.9%