Class: shaka.media.SegmentIndex

Constructor

new SegmentIndex(referencesnon-null)

Creates a SegmentIndex.
Parameters:
Name Type Description
references Array.<!shaka.media.SegmentReference> The list of SegmentReferences, which must be sorted first by their start times (ascending) and second by their end times (ascending), and have continuous, increasing positions.
Implements:
Source:

Members

(private) references_ :Array.<!shaka.media.SegmentReference>

Type:
Source:

Methods

(private, static) assertCorrectReferences_(referencesnon-null)

Asserts that the given SegmentReferences are sorted and have continuous, increasing positions.
Parameters:
Name Type Description
references Array.<shaka.media.SegmentReference>
Source:

destroy() → (non-null) {Promise}

Destroys the object, releasing all resources and shutting down all operations. Returns a Promise which is resolved when destruction is complete. This Promise should never be rejected.
Implements:
Source:
Returns:
Type
Promise

evict(time)

Removes all SegmentReferences that end before the given time.
Parameters:
Name Type Description
time number The time in seconds.
Source:

find(time) → (nullable) {number}

Finds the position of the segment for the given time, in seconds, relative to the start of a particular Period. Returns the position of the segment with the largest end time if more than one segment is known for the given time.
Parameters:
Name Type Description
time number
Source:
Returns:
The position of the segment, or null if the position of the segment could not be determined.
Type
number

get(position) → {shaka.media.SegmentReference}

Gets the SegmentReference for the segment at the given position.
Parameters:
Name Type Description
position number The position of the segment.
Source:
Returns:
The SegmentReference, or null if no such SegmentReference exists.
Type
shaka.media.SegmentReference

merge(referencesnon-null)

Merges the given SegmentReferences. Supports extending the original references only. Will not replace old references or interleave new ones.
Parameters:
Name Type Description
references Array.<!shaka.media.SegmentReference> The list of SegmentReferences, which must be sorted first by their start times (ascending) and second by their end times (ascending), and have continuous, increasing positions.
Source: