No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Platform Language License pod 1.3.1 Swift 4


A comfortable player used to manage the playback and timing of a media asset. Swift Player based on the AVPlayer and give to you a really comfortable interface for general player, timing and buffering state observations. You can easy create custom interface to control the player’s transport behavior such as its ability to play, pause, change the playback rate, and seek to various points in time within the media’s timeline. And you can also set AVPlayerViewControllerPlayer as default interface. You can use an SwiftyPlayer to play local and remote file-based media, such as QuickTime movies and MP3 audio files, as well as audiovisual media served using HTTP Live Streaming.


  • Easy to use
  • Support all actions for player's control
  • General State Observations through methods of delegate
  • Timed State Observations through methods of delegate
  • Buffering State Observations through methods of delegate
  • Using all power AVPlayer
  • Ability to set AVPlayerViewController as default interface


  1. Import SwiftyPlayer module to your ViewController class
import SwiftyPlayer
  1. Instantiate and set playerLayer and videoGravity
let player = Player()
player.setPlayer(to: playerLayerView.playerLayer)
playerLayerView.playerLayer.videoGravity = .resizeAspect
  1. Set delegate and bufferingDelegate if need
player.delegate = self
player.bufferingDelegate = self
  1. Set the URL or AVPlayerItem or AVAsset to player
player.URL = playerURL
player.playerItem = playerItem
player.asset = playerAsset
  1. Create a custom interface with controls and set relevant commands to SwiftyPlayer
@IBAction func play() {

@IBAction func pause() {

@IBAction func didSlide(_ sender: UISlider) { sender.value, shouldAutoPlay: true)
  1. Add a handler for PlayerDelegate if need
func player(_ player: Player, didUpdateTime timePlayed: Double) {
	// to handle timePlayed

func player(_ player: Player, didChangePlaybackState playbackState: PlaybackState) {
	// to handle playbackState

func playerDidPlayToEnd(_ player: Player) {
	// to handle player's event

func playerDidUpdatePlayerItem(_ player: Player) {
	// to handle player's item
  1. Add a handler for PlayerBufferingDelegate if need
func player(_ player: Player, didChangeBufferingState bufferingState: BufferingState) {
	// to handle bufferingState

func playerDidUpdateBufferingProgress(_ player: Player) {
	// to handle bufferingProgress

Installation with CocoaPods

To install via CocoaPods add this lines to your Podfile. You need CocoaPods v. 1.3.1 or higher

$ gem install cocoapods


To integrate SwiftyPlayer into your Xcode project using CocoaPods, specify it in your Podfile:

source ''
platform :ios, '9.0'

target 'TargetName' do
  pod 'SwiftyPlayer', '~> 1.0'

Then, run the following command:

$ pod install


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