Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/piemonte/Player
▶️ Play and stream media in Swift
https://github.com/piemonte/Player
avfoundation ios media player player-swift stream swift tvos video-player
Last synced: 3 days ago
JSON representation
▶️ Play and stream media in Swift
- Host: GitHub
- URL: https://github.com/piemonte/Player
- Owner: piemonte
- License: mit
- Created: 2014-11-26T08:16:48.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2022-08-24T08:19:22.000Z (over 2 years ago)
- Last Synced: 2024-12-01T05:35:24.570Z (11 days ago)
- Topics: avfoundation, ios, media, player, player-swift, stream, swift, tvos, video-player
- Language: Swift
- Homepage:
- Size: 10.6 MB
- Stars: 2,080
- Watchers: 63
- Forks: 334
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Player - video player in Swift, simple way to play and stream media in your iOS or tvOS app. (Media / Video)
- awesome-swift - Player - iOS video player, simple drop in component for playing and streaming media. (Libs / Video)
- awesome-swift - Player - iOS video player, simple drop in component for playing and streaming media. (Libs / Video)
- awesome-ios-star - Player - video player in Swift, simple way to play and stream media in your iOS or tvOS app. (Media / Video)
- fucking-awesome-swift - Player - iOS video player, simple drop in component for playing and streaming media. (Libs / Video)
- awesome-swift-cn - Player - iOS video player in Swift, simple drop in component for playing and streaming media. (Libs / Video)
- awesome-video - piemonte/Player - ▶️ video player in Swift, simple way to play and stream media on iOS/tvOS - piemonte/Player (Players / iOS tvOS)
- awesome-inspiration - Player
- awesome-swift - Player - video player in Swift, simple way to play and stream media on iOS/tvOS ` 📝 4 months ago ` (Video [🔝](#readme))
README
![Player](https://github.com/piemonte/Player/raw/master/Player.gif)
## Player
`Player` is a simple iOS video player library written in [Swift](https://developer.apple.com/swift/).
[![Build Status](https://travis-ci.com/piemonte/Player.svg?branch=master)](https://travis-ci.com/piemonte/Player) [![Pod Version](https://img.shields.io/cocoapods/v/Player.svg?style=flat)](http://cocoadocs.org/docsets/Player/) [![Swift Version](https://img.shields.io/badge/language-swift%205.0-brightgreen.svg)](https://developer.apple.com/swift) [![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/piemonte/Player/blob/master/LICENSE)
- Looking for an obj-c video player? Check out [PBJVideoPlayer (obj-c)](https://github.com/piemonte/PBJVideoPlayer).
- Looking for a Swift camera library? Check out [Next Level](https://github.com/NextLevel/NextLevel).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
- [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
- [x] video frame snapshot support# Quick Start
`Player` is available for installation using the Cocoa dependency manager [CocoaPods](http://cocoapods.org/). Alternatively, you can simply copy the `Player.swift` file into your Xcode project.
```ruby
# 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.
``` Swift
self.player = Player()
self.player.playerDelegate = self
self.player.playbackDelegate = self
self.player.view.frame = self.view.boundsself.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.
``` Swift
let videoUrl: URL = // file or http url
self.player.url = videoUrl
```play/pause
``` Swift
self.player.playFromBeginning()
```Adjust the fill mode for the video, if needed.
``` Swift
self.player.fillMode = .resizeAspectFit
```Display video playback progress, if needed.
``` Swift
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](http://piemonte.github.io/Player/). Documentation is generated with [jazzy](https://github.com/realm/jazzy) and hosted on [GitHub-Pages](https://pages.github.com).
## Community
- Need help? Use [Stack Overflow](http://stackoverflow.com/questions/tagged/player-swift) with the tag 'player-swift'.
- Questions? Use [Stack Overflow](http://stackoverflow.com/questions/tagged/player-swift) with the tag 'player-swift'.
- Found a bug? Open an [issue](https://github.com/piemonte/player/issues).
- Feature idea? Open an [issue](https://github.com/piemonte/player/issues).
- Want to contribute? Submit a [pull request](https://github.com/piemonte/player/pulls).## Resources
* [Swift Evolution](https://github.com/apple/swift-evolution)
* [AV Foundation Programming Guide](https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html)
* [Next Level](https://github.com/NextLevel/NextLevel/), rad media capture in Swift
* [PBJVision](https://github.com/piemonte/PBJVision), iOS camera engine, features touch-to-record video, slow motion video, and photo capture
* [PBJVideoPlayer](https://github.com/piemonte/PBJVideoPlayer), a simple iOS video player library, written in obj-c## License
Player is available under the MIT license, see the [LICENSE](https://github.com/piemonte/player/blob/master/LICENSE) file for more information.