DownloaderAPI Protocol

public protocol DownloaderAPI

Downloader Interface.

  • Creates a downloader instance.

    Declaration

    Swift

    init(withCellularAccess access: Bool,
         andHeaders headers: [String: String],
         _ callbacksQueue: DispatchQueue?)

    Parameters

    access

    Cellular access.

    headers

    List of request headers.

    callbacksQueue

    Completion handlers will be called on this queue.

  • Creates a download for a given player configuration.

    Player Configuration is verified in the prepare method

    Declaration

    Swift

    func createDownload(_ config: PlayerConfiguration, headers: [String : String]) -> Download

    Parameters

    config

    Player configuration.

    headers

    List of request headers.

  • Prepare a single download metadata and track model. The model contains video qualities, audio tracks, and subtitle tracks and implementations need to select which of these tracks should be downloaded.

    Declaration

    Swift

    func prepareDownload(_ downloadId: String, completion: @escaping (Download?, PRESTOError?) 
                         -> Void)

    Parameters

    downloadId

    Download identifier.

    completion

    Called on completion.

  • Starts a given download.

    Declaration

    Swift

    func startDownload(_ downloadId: String, delegate: DownloadDelegate?) -> PRESTOError?

    Parameters

    downloadId

    Download identifier.

    delegate

    Download delegate.

    Return Value

    The error that can occur when pausing the download of the given downloadId.

  • Pause a download.

    Declaration

    Swift

    func pauseDownload(_ downloadId: String) -> PRESTOError?

    Parameters

    downloadId

    Download identifier.

    Return Value

    The error that can occur when pausing the download of the given downloadId.

  • Resume a download.

    Declaration

    Swift

    func resumeDownload(_ downloadId: String) -> PRESTOError?

    Parameters

    downloadId

    Download identifier.

    Return Value

    The error that can occur when resuming the download of the given downloadId.

  • Stops the download progress but keep the content and the reference in the history.

    Declaration

    Swift

    func cancelDownload(_ downloadId: String) -> PRESTOError?

    Parameters

    id

    Download identifier.

    Return Value

    The error that can occur when cancelling the download of the given downloadId.

  • Cancel the download and remove any content and reference from the history.

    Declaration

    Swift

    func removeDownload(_ downloadId: String) -> PRESTOError?

    Parameters

    id

    Download identifier.

    Return Value

    The error that can occur when removing downloaded content for the given downloadId.

  • Get list of ongoing and completed downloads.

    Declaration

    Swift

    func getDownloads() -> [Download]

    Return Value

    list of downloads