Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.
/ SequencePlayer Public archive

Play a series of media files in sequence with no lags on iOS.

License

Notifications You must be signed in to change notification settings

BellAppLab/SequencePlayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Player

Play a series of media files in sequence with no lags on iOS.

v0.1.0

Usage

class ViewController: UIViewController, SequencePlayerDataSource, SequencePlayerDelegate {

    var player: SequencePlayer!

    lazy var urls: [URL] = {
        ...
    }()

    @IBOutlet weak var spinningThing: UIActivityIndicatorView!

    override func viewDidLoad() {
        super.viewDidLoad()

        self.player = SequencePlayer(withDataSource: self,
                                        andDelegate: self)
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)

        self.player.play()
    }

    //MARK: Player Delegate
    func sequencePlayerStateDidChange(_ player: SequencePlayer) {
        switch player.state {
        case .loading:
            self.spinningThing.startAnimating()
        default:
            self.spinningThing.stopAnimating()
        }
    }

    func sequencePlayerDidEnd(_ player: SequencePlayer) {
        
    }

    //MARK: Player Data Source
    func numberOfItemsInSequencePlayer(_ player: SequencePlayer) -> Int {
        return self.urls.count
    }

    func sequencePlayer(_ player: SequencePlayer, itemURLAtIndex index: Int) -> URL {
        return self.urls[index]
    }

    //Use this is your dealing with videos
    
    @IBOutlet weak var playerView: SequencePlayerView!

    func sequencePlayerView(forSequencePlayer player: SequencePlayer) -> SequencePlayerView {
        return self.playerView
    }
}

Requirements

  • iOS 8+
  • Swift 3.0

Installation

Cocoapods

Because of this, I've dropped support for Cocoapods on this repo. I cannot have production code rely on a dependency manager that breaks this badly.

Git Submodules

Why submodules, you ask?

Following this thread and other similar to it, and given that Cocoapods only works with Swift by adding the use_frameworks! directive, there's a strong case for not bloating the app up with too many frameworks. Although git submodules are a bit trickier to work with, the burden of adding dependencies should weigh on the developer, not on the user. 😉

To install Keyboard using git submodules:

cd toYourProjectsFolder
git submodule add -b submodule --name SequencePlayer https://github.com/BellAppLab/SequencePlayer.git

Then, navigate to the new SequencePlayer folder and drag the Source folder into your Xcode project.

Author

Bell App Lab, apps@bellapplab.com

License

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

About

Play a series of media files in sequence with no lags on iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages