Downloader Offline
This module’s goal is to ease the integration of the Downloader Offline and the Akamai AMP Player for iOS. With just a few steps we can achieve this integration, let’s see how.
Installation
Just import the AmpDownloader.framework into your project. For more information check out the AmpCore’s documentation.
Note: Make sure to add the frameworks as Embedded Binaries or you’ll get an error about a missing image.
How to Use
Let’s import the required frameworks:
import AmpCore
import AmpDownloader
The AMP Downloader does not require intitialization, its methods can be used once the framework has been imported.
Configuring the AMP Downloader
For AMP downloader configuration, such as delegate management.
Methods
Methods | Parameters | Usage | Returns |
---|---|---|---|
registerDelegate |
delegate:AmpDownloaderDelegate | Registers a delegate to be notified about downloader related events | |
removeDelegate |
delegate:AmpDownloaderDelegate | Removes the specified delegate | |
Managing Downloads
For download management
Methods
Methods | Parameters | Usage | Returns |
---|---|---|---|
getDownloadList |
Returns the list of downloads | AmpDownload array | |
startNewDownload |
title:String, url:String, assetArtworkData:Data? = nil | Starts a new download | AmpDownload |
resumeDownload |
AmpDownload | Resumes the specified download | |
pauseDownload |
AmpDownload | Pauses the specified download | |
deleteDownload |
AmpDownload | Deletes the specified download | |
cancelDownload |
AmpDownload | Cancels the specified download | |
cancelDownload |
Restores the downloads not previously deleted | ||
AmpDownload
AmpDownload contains the information related to each download
Variables
Variable | Type | Description | Optional |
---|---|---|---|
id |
String | The download id | No |
title |
String | The download title | No |
isCompleted |
String | Whether or not the download has completed | No |
isPaused |
String | Whether or not the download is paused | No |
isCancelled |
String | Whether or not the download is cancelled | No |
originUrl |
String | The download origin URL | No |
asset |
AVURLAsset | The downloaded asset | Yes |
progress |
Float | The progress of the download. This is a value between 0 and 1, where 0 is signals the download start and 1 the completion | Yes |
Methods
Methods | Parameters | Usage | Returns |
---|---|---|---|
deleteVideo |
Deletes downloaded video | ||