Class: shaka.abr.SimpleAbrManager

Constructor

new SimpleAbrManager()

Creates a new SimpleAbrManager.
Implements:
Source:

Members

(private, static, constant) BANDWIDTH_DOWNGRADE_TARGET_ :number

The largest fraction of the estimated bandwidth we should use. We should downgrade to avoid this.
Type:
  • number
Source:

(private, static, constant) BANDWIDTH_UPGRADE_TARGET_ :number

The fraction of the estimated bandwidth which we should try to use when upgrading.
Type:
  • number
Source:

(static, constant) SWITCH_INTERVAL_MS :number

The minimum amount of time that must pass between switches, in milliseconds. This keeps us from changing too often and annoying the user.
Type:
  • number
Source:

(private) bandwidthEstimator_ :shaka.abr.EwmaBandwidthEstimator

Type:
Source:

(private) enabled_ :boolean

Type:
  • boolean
Source:

(private, nullable) lastTimeChosenMs_ :number

The last wall-clock time, in milliseconds, when Streams were chosen via chooseStreams() or switch_().
Type:
  • number
Source:

(private) startupComplete_ :boolean

Type:
  • boolean
Source:

(private) streamsByType_ :Object.<string, shakaExtern.Stream>

The last Streams chosen.
Type:
Source:

(private) streamSetsByType_ :Object.<string, shakaExtern.StreamSet>

The last StreamSets given to us via chooseStreams().
Type:
Source:

(private, nullable) switch_ :shakaExtern.AbrManager.SwitchCallback

Type:
Source:

Methods

(private, static) sortStreamsByBandwidth_(streamSetnon-null) → (non-null) {Array.<shakaExtern.Stream>}

Parameters:
Name Type Description
streamSet shakaExtern.StreamSet
Source:
Returns:
|streamSet|'s Streams sorted in ascending order of bandwidth.
Type
Array.<shakaExtern.Stream>

(private) chooseAudioStream_() → (nullable) {shakaExtern.Stream}

Chooses which audio Stream to switch to.
Source:
Returns:
Type
shakaExtern.Stream

chooseStreams(streamSetsByTypenon-null) → (non-null) {Object.<string, shakaExtern.Stream>}

Chooses one Stream from each StreamSet to switch to. All StreamSets must be from the same Period. Some StreamSets may be absent in the case of language changes.
Parameters:
Name Type Description
streamSetsByType Object.<string, !shakaExtern.StreamSet>
Implements:
Source:
Returns:
Type
Object.<string, shakaExtern.Stream>

(private) chooseStreams_() → (non-null) {Object.<string, !shakaExtern.Stream>}

Chooses which Streams to switch to.
Source:
Returns:
Type
Object.<string, !shakaExtern.Stream>

(private) chooseVideoStream_() → (nullable) {shakaExtern.Stream}

Chooses which video Stream to switch to.
Source:
Returns:
Type
shakaExtern.Stream

disable()

Disables automatic Stream suggestions. After this, the AbrManager may not call switchCallback().
Implements:
Source:

enable()

Enables automatic Stream choices from the last StreamSets passed to chooseStreams(). After this, the AbrManager may call switchCallback() at any time.
Implements:
Source:

getBandwidthEstimate() → {number}

Gets an estimate of the current bandwidth in bit/sec. This is used by the Player to generate stats.
Implements:
Source:
Returns:
Type
number

init(switchCallback)

Initializes the AbrManager.
Parameters:
Name Type Description
switchCallback shakaExtern.AbrManager.SwitchCallback
Implements:
Source:

segmentDownloaded(startTimeMs, endTimeMs, numBytes)

Notifies the AbrManager that a segment has been downloaded (includes MP4 SIDX data, WebM Cues data, initialization segments, and media segments).
Parameters:
Name Type Description
startTimeMs number The wall-clock time, in milliseconds, when the request began (before any outbound request filters).
endTimeMs number The wall-clock time, in milliseconds, when the response ended (after all retries and inbound response filters).
numBytes number The total number of bytes transferred.
Implements:
Source:

setDefaultEstimate(estimate)

Sets the default bandwidth estimate to use if there is not enough data.
Parameters:
Name Type Description
estimate number The default bandwidth estimate, in bit/sec.
Implements:
Source:

stop()

Stops any background timers and frees any objects held by this instance. This will only be called after a call to init.
Implements:
Source:

(private) suggestStreams_()

Calls switch_() with which Streams to switch to.
Source: