Class: DownloadsController

DownloadsController(manifestController, offlineController)

new DownloadsController(manifestController, offlineController)

Parameters:
Name Type Description
manifestController ManifestController existing manifest controller
offlineController OfflineController existing offline controller

Methods

_stopWithStatus(manifestId, onSuccess, onFailure, status, statusDetails) → {void}

Parameters:
Name Type Description
manifestId string manifest identifier
onSuccess function callback to be invoked when stop has been successfully
onFailure function callback to be invoked when stop failed
status string the status
statusDetails string adds details about status (on errors for example)
Returns:
Type
void

isDownloadFinished(manifestId) → {boolean}

Parameters:
Name Type Description
manifestId string manifest identifier
Returns:
- if download is finished
Type
boolean

isDownloadFinishedAndSynced(manifestId) → {boolean}

Parameters:
Name Type Description
manifestId string manifest identifier
Returns:
- if download is finished and synced (info written on disk)
Type
boolean

performSeek(manifestId, localFile, callback) → {void}

Perform a seek - this changes order of fragment download for a manifest
Parameters:
Name Type Description
manifestId string manifest identifier
localFile string local file
callback function callback to get result
Returns:
Type
void

removePromise(manifestId) → {Promise}

Parameters:
Name Type Description
manifestId string manifest identifier
Returns:
- promise
Type
Promise

resume(manifestId, representations, onSuccess, onFailure) → {void}

Parameters:
Name Type Description
manifestId string manifest identifier
representations object object containing video, audio and text representations ids
onSuccess function callback to be invoked when start has been successfully
onFailure function callback to be invoked when start failed
Returns:
Type
void

start(manifestId, representations, downloadFolder, onSuccess, onFailure, fromResumed, oldstatus) → {void}

Parameters:
Name Type Description
manifestId string manifest identifier
representations object object containing video, audio and text representations ids
downloadFolder string download folder for video. If undefined, then default download folder is used
onSuccess function callback to be invoked when start has been successfully
onFailure function callback to be invoked when start failed
fromResumed boolean if start has been called from resume api method
oldstatus string if from resumed, then indicates the old status of download
Returns:
Type
void

startQueue(nextManifestPositionInArrayopt, forceDownload) → {void}

Parameters:
Name Type Attributes Description
nextManifestPositionInArray number <optional>
index from array to decide which manifest should be downloaded next (queue)
forceDownload boolean true to force next download to be queued
Returns:
Type
void

stop(manifestId, onSuccess, onFailure) → {void}

Parameters:
Name Type Description
manifestId string manifest identifier
onSuccess function callback to be invoked when stop has been successfully
onFailure function callback to be invoked when stop failed
Returns:
Type
void

stopPromise(manifestId, ignoreStopped) → {Promise}

Parameters:
Name Type Description
manifestId string manifest identifier
ignoreStopped boolean don't fail if download has been already stopped
Returns:
- promise
Type
Promise

updateDownloadFolder(manifestId, downloadFolder, onSuccess, onFailure) → {void}

Update download folder path
Parameters:
Name Type Description
manifestId string manifest identifier
downloadFolder string new download folder
onSuccess function callback to be invoked when start has been successfully
onFailure function callback to be invoked when start failed
Returns:
Type
void