Class: shaka.media.QualityObserver

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

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:
Type
shaka.extern.MediaQualityInfo

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:
Type
shaka.media.QualityObserver.ContentTypeState

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:

Type Definitions

ContentTypeState

Contains media quality information for a specific content type e.g. video or audio.
Type:
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:

QualityChangePosition

Identifies the position of a media quality change in the source buffer.
Type:
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: