Class: shaka.offline.DownloadManager

Constructor

new DownloadManager(netEnginenon-null, retryParams, config)

This manages downloading segments and notifying the app of progress.
Parameters:
Name Type Description
netEngine shaka.net.NetworkingEngine
retryParams shakaExtern.RetryParameters
config shakaExtern.OfflineConfiguration
Implements:
Source:

Members

(private) bandwidthBytesDownloaded_ :number

The estimated number of bytes downloaded for segments that do not have a byte range.
Type:
  • number
Source:

(private) bandwidthBytesTotal_ :number

The total number of bytes estimated based on bandwidth for segments that do not include a byte range.
Type:
  • number
Source:

(private, nullable) config_ :shakaExtern.OfflineConfiguration

Type:
Source:

(private) givenBytesDownloaded_ :number

The number of bytes downloaded for segments that include a byte range.
Type:
  • number
Source:

(private) givenBytesTotal_ :number

The total number of bytes for segments that include a byte range.
Type:
  • number
Source:

(private, nullable) manifest_ :shakaExtern.ManifestDB

Type:
Source:

(private) netEngine_ :shaka.net.NetworkingEngine

Type:
Source:

(private) promise_ :Promise

Type:
  • Promise
Source:

(private, nullable) retryParams_ :shakaExtern.RetryParameters

Type:
Source:

(private, non-null) segments_ :Object.<string, !Array.<shaka.offline.DownloadManager.Segment>>

Type:
Source:

Methods

addSegment(type, ref, bandwidthSize, callback)

Adds a segment to the list to be downloaded.
Parameters:
Name Type Description
type string
ref shaka.media.SegmentReference | shaka.media.InitSegmentReference
bandwidthSize number
callback function(!ArrayBuffer): !Promise
Source:

destroy() → (non-null) {Promise}

Destroys the object, releasing all resources and shutting down all operations. Returns a Promise which is resolved when destruction is complete. This Promise should never be rejected.
Implements:
Source:
Returns:
Type
Promise

download(manifest) → (non-null) {Promise}

Downloads all the segments.
Parameters:
Name Type Description
manifest shakaExtern.ManifestDB
Source:
Returns:
Type
Promise

(private) downloadSegment_(segment) → (non-null) {Promise}

Downloads the given segment and calls the callback.
Parameters:
Name Type Description
segment shaka.offline.DownloadManager.Segment
Source:
Returns:
Type
Promise

(private) updateProgress_()

Calls the progress callback.
Source:

Type Definitions

Segment

Type:
  • {uris: !Array.<string>, startByte: number, endByte: ?number, bandwidthSize: number, callback: function(!ArrayBuffer): !Promise}
Properties:
Name Type Attributes Description
uris Array.<string> The URIs to download the segment.
startByte number The byte index the segment starts at.
endByte number <nullable>
The byte index the segment ends at, if present.
bandwidthSize number The size of the segment as estimated by the bandwidth and segment duration.
callback function(!ArrayBuffer): !Promise The callback to call once the segment is downloaded.
Source: