Class: shaka.offline.DownloadProgressEstimator

Constructor

new DownloadProgressEstimator()

Source:

Members

actualDownloaded_ :number

This is the total number of bytes actually downloaded. This will most likely differ from |estimatedTotal_| after everything is downloaded since our estimates will be off.
Type:
  • number
Source:

estimatedDownloaded_ :number

This is the sum of all estimates pass to |open| but only after |close| has been called. This is used as the numerator when measuring progress so that |estimatedTotal_ == estimatedDownloaded_| after everything is downloaded.
Type:
  • number
Source:

estimatedTotal_ :number

This is the sum of all estimates passed to |open|. This is used as the denominator when measuring progress.
Type:
  • number
Source:

nextId_ :number

This number is used to provide unique (to estimator) ids for each download. This allows us to track each download in |pending_|.
Type:
  • number
Source:

pending_ :Map.<number, number>

This is a map of all pending downloads. This maps their download id (an internal id) to the estimate. This will allow us to update |estimatedDownloaded_| when |close| is called.
Type:
  • Map.<number, number>
Source:

Methods

close(id, actual)

Close a download in the estimator. This will signal that we have finished downloading a segment and we can update the progress estimate.
Parameters:
Name Type Description
id number
actual number
Source:

getEstimatedProgress() → {number}

Get the current estimate for how much progress we've made downloading the content. Progress will be between 0 and 1. Depending on the order of calls to |open| and |close|, |getEstimatedProgress| will fluctuate and is not guaranteed to always be increasing.
Source:
Returns:
Type
number

getTotalDownloaded() → {number}

Get the total number of bytes that were actually downloaded.
Source:
Returns:
Type
number

open(estimate) → {number}

Open a new download in the progress estimator. This will create an entry so that we can track the download progress. This will return an id for the download. This id must be passed to |close| in order for the |close| to be paired with this call to |open|.
Parameters:
Name Type Description
estimate number
Source:
Returns:
Type
number