Constructor
new LiveSegmentIndex(referencesnon-null, mpdnon-null, periodnon-null, manifestCreationTime)
Creates a SegmentIndex that supports live DASH content.
A LiveSegmentIndex automatically evicts SegmentReferences that are no longer
available. However, it does not generate any new SegmentReferences.
Additional SegmentReferences can be added to the SegmentIndex by integrating
another SegmentIndex into it.
Parameters:
Name | Type | Description |
---|---|---|
references |
Array.<!shaka.media.SegmentReference> | The set of SegmentReferences. The live-edge is the start time of the last SegmentReference. |
mpd |
shaka.dash.mpd.Mpd | |
period |
shaka.dash.mpd.Period | |
manifestCreationTime |
number | The time, in seconds, when the manifest was created. |
- Extends:
- Source:
Members
-
(protected, nullable) duration :number
-
Type:
- number
- Source:
-
(protected) manifestCreationTime :number
-
Type:
- number
- Source:
-
(protected, non-null) mpd :shaka.dash.mpd.Mpd
-
Type:
- Source:
-
(private, nullable) originalLiveEdge_ :number
-
Either the time of the live-edge when the manifest was created, in seconds, or null if this SegmentIndex has never contained any SegmentReferences. The original live-edge is the same as the original latest available segment start time. The live-edge is not taken to be the end time of the last SegmentReference (i.e., the latest available segment end time), as if it were, there wouldn't be any content in front of the playhead during stream startup.
Type:
- number
- Source:
-
(private, nullable) originalPresentationTime_ :number
-
Either the current presentation time when the manifest was created, in seconds, or null if this SegmentIndex has never contained any SegmentReferences.
Type:
- number
- Source:
-
(protected, non-null) period :shaka.dash.mpd.Period
-
Type:
- Source:
-
(private, nullable) seekStartTime_ :number
-
Either the seek start time, in seconds, or null if this SegmentIndex has never contained any SegmentReferences. The seek start time moves "continuously" from the start of the earliest available segment to the end of the earliest available segment. It is not taken as the earliest available segment start time directly because if it were, it would end up moving stepwise, which is undesirable.
Type:
- number
- Source:
Methods
-
(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. - Source:
-
(private) evictEnd_()
-
Evicts segments that are past the end of the stream.
- 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. - Source:
Returns:
-
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. -
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:
-
getSeekRange()
-
- Overrides:
- Source:
-
(protected) getSeekRangeInternal(wallTime) → {{start: number, end: ?number}}
-
Parameters:
Name Type Description wallTime
number The wall-clock time in seconds. - Source:
Returns:
- Type
- {start: number, end: ?number}
-
(protected) initializeSeekWindow()
-
Initializes the seek window, if possible, during construction or after integrating a SegmentIndex.
- Source:
-
integrate()
-
- 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. -
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.
- Source: