Constructor
new QualityObserver(getBufferedInfonon-null)
Creates a new QualityObserver.
Parameters:
Name | Type | Description |
---|---|---|
getBufferedInfo |
function | Buffered info is needed to purge QualityChanges that are no longer relevant. |
- Implements:
- Source:
Members
contentTypeStates_ :Map.<string, !shaka.media.QualityObserver.ContentTypeState>
Type:
- Map.<string, !shaka.media.QualityObserver.ContentTypeState>
- Source:
getBufferedInfo_
- Source:
Methods
getMediaQualityAtPosition_(positionnon-null, contentTypeStatenon-null) → {shaka.extern.MediaQualityInfo}
Determines the media quality at a specific position in the source buffer.
Parameters:
Name | Type | Description |
---|---|---|
position |
number | Position in seconds |
contentTypeState |
shaka.media.QualityObserver.ContentTypeState |
- Source:
Returns:
mediaQualitiesAreTheSame_(mq1nullable, mq2nullable) → {boolean}
Determines if two MediaQualityInfo objects are the same or not.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
mq1 |
shaka.extern.MediaQualityInfo |
<nullable> |
|
mq2 |
shaka.extern.MediaQualityInfo |
<nullable> |
- Source:
Returns:
- Type
- boolean
addMediaQualityChange(mediaQualitynon-null, positionnon-null)
Adds a QualityChangePosition for the contentType identified by
the mediaQuality.contentType.
Parameters:
Name | Type | Description |
---|---|---|
mediaQuality |
shaka.extern.MediaQualityInfo | |
position |
number | Position in seconds of the quality change. |
- Source:
getContentTypeState_(contentTypenon-null) → {shaka.media.QualityObserver.ContentTypeState}
Get the ContenTypeState for a contentType, creating a new
one if necessary.
Parameters:
Name | Type | Description |
---|---|---|
contentType |
string | The contend type e.g. "video" or "audio". |
- Source:
Returns:
onQualityChange_()
- Source:
poll(positionInSeconds, wasSeeking)
Check again (using an update playhead summary) if an event should be fired.
If an event should be fired, fire it.
Parameters:
Name | Type | Description |
---|---|---|
positionInSeconds |
number | |
wasSeeking |
boolean |
- Implements:
- Source:
positionIsBuffered_(positionnon-null, contentTypenon-null)
Determine if a position is buffered for a given content type.
Parameters:
Name | Type | Description |
---|---|---|
position |
number | |
contentType |
string |
- Source:
purgeQualityChangePositions_(contentTypeStatenon-null)
Removes the QualityChangePosition(s) that are not relevant to the buffered
content of the specified contentType. Note that this function is
invoked just before adding the quality change info associated with
the next media segment to be appended.
Parameters:
Name | Type | Description |
---|---|---|
contentTypeState |
shaka.media.QualityObserver.ContentTypeState |
- Source:
release()
Request that this object release all internal references.
- Inherited From:
- Implements:
- Source:
setListeners(onQualityChange)
Set all the listeners. This overrides any previous calls to |setListeners|.
Parameters:
Name | Type | Description |
---|---|---|
onQualityChange |
shaka.media.QualityObserver.EventListener |
- Source:
Type Definitions
ContentTypeState
Contains media quality information for a specific content type
e.g video or audio.
Type:
- {qualityChangePositions: !Array.<shaka.media.QualityObserver.QualityChangePosition>, currentQuality: ?shaka.extern.MediaQualityInfo, contentType: !string}
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
qualityChangePositions |
Array.<shaka.media.QualityObserver.QualityChangePosition> | Quality changes ordered by position ascending. | |
currentMediaQuality |
shaka.media.MediaQualityInfo |
<nullable> |
The media quality at the playhead position. |
contentType |
string | The contentType e.g. 'video' or 'audio' |
- Source:
EventListener
A callback function used to notify the player when media quality changes
are detected at the playhead.
The first argument is information about media quality at the playhead
position.
The second argument is the playhead position in seconds.
Type:
- function(shaka.extern.MediaQualityInfo, number)
- Source:
QualityChangePosition
Identifies the position of a media quality change in the
source buffer.
Type:
- {mediaQuality: !shaka.extern.MediaQualityInfo, position: !number}
Properties:
Name | Type | Description |
---|---|---|
!mediaQuality |
shaka.extern.MediaQualityInfo | The new media quality for content after position in the source buffer. |
!position |
number | A position in seconds in the source buffer |
- Source: