Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-plus/HLSion
HTTP Live Streaming (HLS) download manager to offline playback.
https://github.com/r-plus/HLSion
Last synced: 3 months ago
JSON representation
HTTP Live Streaming (HLS) download manager to offline playback.
- Host: GitHub
- URL: https://github.com/r-plus/HLSion
- Owner: r-plus
- License: other
- Created: 2016-11-13T15:29:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-12-11T00:42:30.000Z (almost 4 years ago)
- Last Synced: 2024-04-09T18:04:10.946Z (7 months ago)
- Language: Swift
- Size: 27.3 KB
- Stars: 76
- Watchers: 2
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-video - r-plus/HLSion - HTTP Live Streaming (HLS) download manager to offline playback. - r-plus/HLSion (HLS / Talks Presentations Podcasts)
README
# HLSion
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
HTTP Live Streaming (HLS) download manager to offline playback.
## Requirements
- iOS 10.0+
- Xcode 8.0+
- Swift 3.0+## Installation
Add below to your `Cartfile`.
```ogdl
github "r-plus/HLSion" "master"
```Thus build framework.
```bash
carthage update HLSion
```## Usage
```swift
import HLSionlet url = URL(string: "https://...m3u8")!
let hlsion = HLSion(url: url, name: "identifier").download { (progressPercentage) in
// call while each file downloaded.
}.finish { (relativePath) in
// call when complete or cancel download task finish.
}.onError { (error) in
// call when error finish.
}// cancelable.
hlsion.cancelDownload()// delete downloaded asset.
hlsion.deleteAsset()
```Play after download.
```swift
guard let localUrl = hlsion.localUrl else {
// This instance not yet downloaded.
return
}
let localAsset = AVURLAsset(url: localUrl)
let playerItem = AVPlayerItem(asset: localAsset)
let player = AVPlayer(playerItem: playerItem)
player.play()
```