Constructor
new DownloadManager(storageEngine, netEnginenon-null, retryParams, config)
This manages downloading segments and notifying the app of progress.
Parameters:
Name | Type | Description |
---|---|---|
storageEngine |
shaka.offline.IStorageEngine | |
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:
- Object.<string, !Array.<shaka.offline.DownloadManager.Segment>>
- Source:
-
(private) storageEngine_ :shaka.offline.IStorageEngine
-
Type:
- Source:
-
(private, non-null) storedSegments_ :Array.<number>
-
The IDs of the segments that have been stored for an in-progress download(). This is used to cleanup in destroy().
Type:
- Array.<number>
- Source:
Methods
-
addSegment(type, ref, bandwidthSize, segmentDb)
-
Adds a segment to the list to be downloaded.
Parameters:
Name Type Description type
string ref
shaka.media.SegmentReference | shaka.media.InitSegmentReference bandwidthSize
number segmentDb
shakaExtern.SegmentDataDB The data to store in the database with the data. The |data| field of this object will contain the downloaded data. - 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
-
downloadAndStore(manifest) → (non-null) {Promise}
-
Downloads all the segments, stores them in the database, and stores the given manifest object.
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, segmentDb: shakaExtern.SegmentDataDB}
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. segmentDb
shakaExtern.SegmentDataDB The data to store in the database. - Source: