Constructor
new SimpleAbrManager()
Creates a SimpleAbrManager, which selects video tracks using a basic set of
heuristics.
- Implements:
- Source:
Members
-
(private, static, constant) BANDWIDTH_DOWNGRADE_TARGET_ :number
-
The fraction of the estimated bandwidth we should downgrade to avoid exceeding.
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:
-
(private, static, constant) FIRST_SWITCH_INTERVAL_ :number
-
The minimum amount of time that must pass before the first switch, in milliseconds. This gives the bandwidth estimator time to get some real data before changing anything.
Type:
- number
- Source:
-
(private, static, constant) MIN_EVAL_INTERVAL_ :number
-
The minimum amount of time that must pass between bandwidth evaluations, in milliseconds. This keeps us from checking for adaptation opportunities too often.
Type:
- number
- Source:
-
(private, static, constant) MIN_SWITCH_INTERVAL_ :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) enabled_ :boolean
-
Type:
- boolean
- Source:
-
(private) estimator_ :shaka.util.IBandwidthEstimator
-
Type:
- Source:
-
(private, non-null) eventManager_ :shaka.util.EventManager
-
Type:
- Source:
-
(private) nextAdaptationTime_ :number
-
The timestamp after which we are allowed to adapt, in milliseconds.
Type:
- number
- Source:
-
(private) started_ :boolean
-
Type:
- boolean
- Source:
-
(private) videoSource_ :shaka.player.IVideoSource
-
Type:
- Source:
Methods
-
(private, static) findActiveTrack_(trackListnon-null) → {T}
-
Find the active track in the list.
Parameters:
Name Type Description trackList
Array.<T> - Source:
Returns:
- Type
- T
-
(private) chooseNewTrack_(eventnon-null)
-
Makes adaptation decisions.
Parameters:
Name Type Description event
Event - Source:
-
(private) chooseVideoTrack_() → {shaka.player.VideoTrack}
-
Choose a video track based on current bandwidth conditions.
- Source:
Returns:
The chosen video track or null if there are no video tracks to choose. -
destroy()
-
Destroy the AbrManager.
- Implements:
- Source:
-
enable(enabled)
-
Enable or disable the AbrManager. It is enabled by default when created.
Parameters:
Name Type Description enabled
boolean - Implements:
- Source:
-
getInitialVideoTrackId() → (nullable) {number}
-
Decide on an initial video track to use. Called before playback begins.
- Implements:
- Source:
Returns:
The chosen video track ID or null if there are no video tracks to choose.- Type
- number
-
initialize(estimatornon-null, videoSourcenon-null)
-
Initialize the AbrManager. This function will only be called by a VideoSource and should only be called once.
Parameters:
Name Type Description estimator
shaka.util.IBandwidthEstimator videoSource
shaka.player.IVideoSource - Implements:
- Source:
-
(private) onAdaptation_(eventnon-null)
-
Handles adaptation events.
Parameters:
Name Type Description event
Event - Source:
-
(private) onBandwidth_(eventnon-null)
-
Handles bandwidth update events.
Parameters:
Name Type Description event
Event - Source:
-
(protected) selectVideoTrack(track, clearBuffer, opt_clearBufferOffsetopt)
-
Select the specified video track. Does nothing if the AbrManager has not been started.
Parameters:
Name Type Attributes Description track
shaka.player.VideoTrack the track to the switch to clearBuffer
boolean If true, removes the previous stream's content before switching to the new stream. opt_clearBufferOffset
number <optional>
if |clearBuffer| and |opt_clearBufferOffset| are truthy, clear the stream buffer from the given offset (relative to the video's current time) to the end of the stream. - Source:
-
start()
-
Start processing stream switches. This function will only be called by a VideoSource and should only be called once.
- Implements:
- Source: