Class: shaka.media.PeriodObserver

Constructor

new PeriodObserver(manifest)

The period observer needs an always-up-to-date collection of periods, and right now the only way to have that is to reference the manifest.
Parameters:
Name Type Description
manifest shaka.extern.Manifest
Implements:
Source:

Members

(private, nullable) currentPeriod_ :shaka.extern.Period

This will be which period we think the playhead is currently in. If it is |null|, it means we don't know. We say "we think" because this may become out-of-date between updates.
Type:
Source:

Methods

(private) findCurrentPeriod_(currentTimeSeconds) → {shaka.extern.Period}

Find which period we are most likely in based on the current manifest and current time. The value here may be different than |this.currentPeriod_|, if that is true, it means we changed periods since the last time we updated |this.currentPeriod_|.
Parameters:
Name Type Description
currentTimeSeconds number
Source:
Returns:
Type
shaka.extern.Period

(private) onChangedPeriods_()

The callback for when we change periods. To avoid null-checks, assign it a no-op when there is no external callback assigned to it. When we move into a new period, this callback will be called with the new period.
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:

(export) release()

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

setListeners(onChangedPeriods)

Set all callbacks. This will override any previous calls to |setListeners|.
Parameters:
Name Type Description
onChangedPeriods function(shaka.extern.Period) The callback for when we move to a new period.
Source: