Class: shaka.media.PlayRateController

Constructor

new PlayRateController(harness)

Parameters:
Name Type Description
harness shaka.media.PlayRateController.Harness
Implements:
Source:

Members

pollRate_ :number

Type:
  • number
Source:

rate_ :number

Type:
  • number
Source:

Methods

apply_()

Reapply the effects of |this.rate_| and |this.active_| to the media element. This will only update the rate via the harness if the desired rate has changed.
Source:

applyRate_(newRate) → {boolean}

If the new rate is different than the media element's playback rate, this will change the playback rate. If the rate does not need to change, it will not be set. This will avoid unnecessary ratechange events.
Parameters:
Name Type Description
newRate number
Source:
Returns:
Type
boolean

getDefaultRate() → {number}

Get the default play rate of the playback.
Source:
Returns:
Type
number

getRealRate() → {number}

Get the real rate of the playback. This means that if we are using trick play, this will report the trick play rate. If playback is occurring as normal, this will report 1.
Source:
Returns:
Type
number

release()

Request that this object release all internal references.
Implements:
Source:

set(rate)

Set the playback rate.
Parameters:
Name Type Description
rate number
Source:

Type Definitions

Harness

A layer of abstraction between the controller and what it is controlling. In tests this will be implemented with spies. In production this will be implemented using a media element.
Type:
  • {getRate: function(): number, getDefaultRate: function(): number, setRate: function(number), movePlayhead: function(number)}
Properties:
Name Type Description
getRate function Get the current playback rate being seen by the user.
getDefaultRate function Get the default playback rate that the user should see.
setRate function Set the playback rate that the user should see.
movePlayhead function Move the playhead N seconds. If N is positive, the playhead will move forward abs(N) seconds. If N is negative, the playhead will move backwards abs(N) seconds.
Source: