Player
is a simple iOS video player library written in Swift.
- plays local media or streams remote media over HTTP
- customizable UI and user interaction
- no size restrictions
- orientation change support
- simple API
If you're looking for a video player library written in Objective-C, checkout PBJVideoPlayer. For video recording, checkout PBJVision.
Xcode 6.3 and Swift 1.2 support can be found on a branch.
Player
is available and recommended for installation using the Cocoa dependency manager CocoaPods. CocoaPods is still adding support for Swift, so a pre-release version is required.
To integrate, just add the following line in your Podfile
:
pod ‘Player’
Installation is also available using the dependency manager Carthage.
To integrate, add the following line to your Cartfile
:
github “piemonte/Player” >= 0.0.1
You can also simply copy the Player.swift
file into your Xcode project.
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.delegate = 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.
self.player.path = "Video.mp4"
play/pause/chill
self.player.playFromBeginning()
Adjust the fill mode for the video, if needed.
self.player.fillMode = “AVLayerVideoGravityResizeAspect”
- Need help? Use Stack Overflow with the tag 'player-swift'.
- Questions? Use Stack Overflow with the tag 'player-swift'.
- Found a bug? Open an issue.
- Feature idea? Open an issue.
- Want to contribute? Submit a pull request.
- AV Foundation Programming Guide
- PBJVision, iOS camera engine, features touch-to-record video, slow motion video, and photo capture
- PBJVideoPlayer, a simple iOS video player library, written in Objective-C
- objc.io Issue #16, Swift
Player is available under the MIT license, see the LICENSE file for more information.