Skip to content
This repository has been archived by the owner on Jun 28, 2019. It is now read-only.

Latest commit

 

History

History
171 lines (130 loc) · 4.17 KB

README.md

File metadata and controls

171 lines (130 loc) · 4.17 KB

Make m3u8 parse and video download as white magic.

Pods Version Platforms Carthage Swift Package Manager Swift Version License Twitter


Features
Parse and download m3u8 files
Customize downloading progress
Pure Swift

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Xcode 8.0+
  • iOS 9.0+
  • Swift 3.0+

Note:

  • Your m3u8 file should include #EXFINT information to make parsing pass.
  • Your local server's port should be 8080 to make local video play.

Usage

Define dowloading directory name:

let directoryName = "Name"
let lemonDeer = LemonDeer()
lemonDeer.directoryName = directoryName

Parse and begin downloading m3u8 with URL:

let directoryName = "Name"
let lemonDeer = LemonDeer()
lemonDeer.directoryName = directoryName

let url = "https://urlstring.m3u8"
lemonDeer.m3u8URL = url
lemonDeer.parse()

Manipulate downloading process:

  • Pause
lemonDeer.downloader.pauseDownloadSegment()
  • Resume
lemonDeer.downloader.resumeDownloadSegment()
  • Cancel
lemonDeer.downloader.cancelDownloadSegment()

Delete downloaded contents

  • Delete a specific directory
lemonDeer.downloader.deleteDownloadedContents(with: ("DirectoryNameYouWantToDelete")
  • Delete all downloaded contents
lemonDeer.downloader.deleteAllDownloadedContents()

Define your own after download succeeded

class YourClass: LemonDeerDelegate {
  func videoDownloadSucceeded()
}

Define your own after download failed

class YourClass: LemonDeerDelegate {
  func videoDownloadFailed()
}

Customize downloading progress

class YourClass: LemonDeerDelegate {
  func update(_ progress: Float, with directoryName: String) {}
}

Installation

Installation with CocoaPods

LemonDeer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LemonDeer"

Installation with Carthage

Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.

To install with carthage, follow the instruction on Carthage

Cartfile

github "hipposan/LemonDeer"

Installation with Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. Just add the url of this repo to your Package.swift file as a dependency:

import PackageDescription

let package = Package(
    name: "YourPackage",
    dependencies: [
        .Package(url: "https://github.com/hipposan/LemonDeer.git", majorVersion: 1.0.0)
    ]
)

Author

Contact me at Twitter.

License

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