Class: shaka.dash.DynamicLiveSegmentIndex

Constructor

new DynamicLiveSegmentIndex(mpdnon-null, periodnon-null, representationnon-null, manifestCreationTime, networkCallback)

Creates a SegmentIndex that supports live DASH content by generating SegmentReferences as needed and automatically evicting SegmentReferences that are no longer available. If the SegmentIndex's corresponding stream is not available yet then the SegmentIndex will be inactive: it will not contain any SegmentReferences nor will it generate any new SegmentReferences. An inactive SegmentIndex can be activated by integrating an active SegmentIndex into it.
Parameters:
Name Type Description
mpd shaka.dash.mpd.Mpd
period shaka.dash.mpd.Period
representation shaka.dash.mpd.Representation
manifestCreationTime number The time, in seconds, when the manifest was created.
networkCallback shaka.util.FailoverUri.NetworkCallback
Extends:
Source:
Throws:
If the SegmentIndex's corresponding stream is available but the initial SegmentReferences could not be generated.
Type
Error

Members

(private, nullable) latestAvailableSegmentEndTime_ :number

Either the time when the last segment became available, in seconds, or null if this SegmentIndex is inactive.
Type:
  • number
Source:

(private) networkCallback_ :shaka.util.FailoverUri.NetworkCallback

Type:
Source:

(private, nullable) nextSegmentNumber_ :number

Either the segment number (one-based) of the next new SegmentReference, or null if this SegmentIndex is inactive.
Type:
  • number
Source:

(private, nullable) originalLatestAvailableSegmentEndTime_ :number

Either the time when the last segment became available when the manifest was created, in seconds, or null if this SegmentIndex is inactive.
Type:
  • number
Source:

(private, non-null) representation_ :shaka.dash.mpd.Representation

Type:
Source:

Methods

(private, static) computeAvailableSegmentRange_(mpdnon-null, periodnon-null, representationnon-null, manifestCreationTime) → (nullable) {?{earliest: number, current: number}}

Computes the segment numbers of the earliest segment and the current segment, both relative to the start of |period|. Assumes the MPD is dynamic and the Representation has a SegmentTemplate that specifies a segment duration. The earliest segment is the segment with the smallest start time that is still available from the media server. The current segment is the segment with the largest start time that is available from the media server and that also respects the 'suggestedPresentationDelay' attribute.
Parameters:
Name Type Description
mpd shaka.dash.mpd.Mpd
period shaka.dash.mpd.Period
representation shaka.dash.mpd.Representation
manifestCreationTime number The time, in seconds, when the manifest was created.
Source:
Returns:
Two segment numbers (both one-based), or null if the stream is not available yet.
Type
?{earliest: number, current: number}

(protected) assertCorrectReferences()

Asserts that the SegmentReferences meet all requirements. For debugging purposes.
Inherited From:
Source:

correct()

Overrides:
Source:

destroy()

Overrides:
Source:

(private) evict_(wallTime)

Removes all inaccessible SegmentReferences.
Parameters:
Name Type Description
wallTime number The current wall-clock time in seconds.
Inherited From:
Source:

(private) evictEnd_()

Evicts segments that are past the end of the stream.
Inherited From:
Source:

find()

Overrides:
Source:

(protected) findInternal(targetTime, wallTime) → {shaka.media.SegmentReference}

Finds a SegmentReference for the specified time.
Parameters:
Name Type Description
targetTime number The time in seconds.
wallTime number The current wall-clock time in seconds.
Inherited From:
Source:
Returns:
Type
shaka.media.SegmentReference

first() → (non-null) {shaka.media.SegmentReference}

Gets the first SegmentReference.
Inherited From:
Source:
Throws:
when there are no SegmentReferences.
Type
RangeError
Returns:
The first SegmentReference.
Type
shaka.media.SegmentReference

(private) generateSegmentReferences_(wallTime)

Parameters:
Name Type Description
wallTime number The current wall-clock time in seconds.
Source:

get(index) → (non-null) {shaka.media.SegmentReference}

Gets the SegmentReference at the given index.
Parameters:
Name Type Description
index number
Inherited From:
Source:
Throws:
when |index| is out of range.
Type
RangeError
Returns:
Type
shaka.media.SegmentReference

getSeekRange()

Overrides:
Source:

(protected) getSeekRangeInternal(wallTime) → {{start: number, end: ?number}}

Parameters:
Name Type Description
wallTime number The wall-clock time in seconds.
Inherited From:
Source:
Returns:
Type
{start: number, end: ?number}

(protected) initializeSeekWindow()

Initializes the seek window, if possible, during construction or after integrating a SegmentIndex.
Inherited From:
Source:

integrate()

Integrates |segmentIndex| into this SegmentIndex, but only if this SegmentIndex is inactive and |segmentIndex| is an active DynamicLiveSegmentIndex.
Overrides:
Source:

last() → (non-null) {shaka.media.SegmentReference}

Gets the last SegmentReference.
Inherited From:
Source:
Throws:
when there are no SegmentReferences.
Type
RangeError
Returns:
The last SegmentReference.
Type
shaka.media.SegmentReference

length() → {number}

Gets the number of SegmentReferences.
Inherited From:
Source:
Returns:
Type
number

(protected) merge(segmentIndexnon-null)

Merges |segmentIndex| into this SegmentIndex, but only if it covers times greater than or equal to times that this SegmentIndex covers. Takes into account timestamp corrections.
Parameters:
Name Type Description
segmentIndex shaka.media.SegmentIndex
Inherited From:
Source:

(private) setOriginalPresentationTime_()

Sets the original presentation time.
Inherited From:
Source: