Class: shaka.media.SegmentReference

Constructor

new SegmentReference(startTime, endTime, uris, startByte, endBytenullable, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferencesopt, non-null, tilesLayoutopt, nullable, tileDurationopt, nullable, syncTimeopt, nullable, statusopt, hlsAes128Keyopt, nullable)

Parameters:
Name Type Attributes Default Description
startTime number The segment's start time in seconds.
endTime number The segment's end time in seconds. The segment ends the instant before this time, so |endTime| must be strictly greater than |startTime|.
uris function A function that creates the URIs of the resource containing the segment.
startByte number The offset from the start of the resource to the start of the segment.
endByte number <nullable>
The offset from the start of the resource to the end of the segment, inclusive. A value of null indicates that the segment extends to the end of the resource.
initSegmentReference shaka.media.InitSegmentReference The segment's initialization segment metadata, or null if the segments are self-initializing.
timestampOffset number The amount of time, in seconds, that must be added to the segment's internal timestamps to align it to the presentation timeline.
For DASH, this value should equal the Period start time minus the first presentation timestamp of the first frame/sample in the Period. For example, for MP4 based streams, this value should equal Period start minus the first segment's tfdt box's 'baseMediaDecodeTime' field (after it has been converted to seconds).
For HLS, this value should be 0 to keep the presentation time at the most recent discontinuity minus the corresponding media time.
appendWindowStart number The start of the append window for this reference, relative to the presentation. Any content from before this time will be removed by MediaSource.
appendWindowEnd number The end of the append window for this reference, relative to the presentation. Any content from after this time will be removed by MediaSource.
partialReferences Array.<!shaka.media.SegmentReference> <optional>
A list of SegmentReferences for the partial segments.
tilesLayout string <optional>
<nullable>
The value is a grid-item-dimension consisting of two positive decimal integers in the format: column-x-row ('4x3'). It describes the arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
tileDuration number <optional>
<nullable>
null The explicit duration of an individual tile within the tiles grid. If not provided, the duration should be automatically calculated based on the duration of the reference.
syncTime number <optional>
<nullable>
null A time value, expressed in seconds since 1970, which is used to synchronize between streams. Both produced and consumed by the HLS parser. Other components should not need this value.
status shaka.media.SegmentReference.Status <optional>
The segment status is used to indicate that a segment does not exist or is not available.
hlsAes128Key shaka.extern.HlsAes128Key <optional>
<nullable>
null The segment's AES-128-CBC full segment encryption key and iv.
Source:

Members

Status :number

Rather than using booleans to communicate what the state of the reference, we have this enum.
Type:
  • number
Properties:
Name Value Type Description
AVAILABLE 0 number
UNAVAILABLE 1 number
MISSING 2 number
Source:

appendWindowEnd :number

Type:
  • number
Source:

appendWindowStart :number

Type:
  • number
Source:

endByte :number

Type:
  • number
Source:

endTime :number

Type:
  • number
Source:

getUrisInner :function(): !Array.<string>

Type:
  • function(): !Array.<string>
Source:

startByte :number

Type:
  • number
Source:

startTime :number

Type:
  • number
Source:

syncTime :number

A time value, expressed in seconds since 1970, which is used to synchronize between streams. Both produced and consumed by the HLS parser. Other components should not need this value.
Type:
  • number
Source:

tileDuration :number

Type:
  • number
Source:

tilesLayout :string

Type:
  • string
Source:

timestampOffset :number

Type:
  • number
Source:

trueEndTime :number

The "true" end time of the segment, without considering the period end time. This is necessary for thumbnail segments, where timing requires us to know the original segment duration as described in the manifest.
Type:
  • number
Source:

Methods

getEndByte() → {number}

Returns the offset from the start of the resource to the end of the segment, inclusive. A value of null indicates that the segment extends to the end of the resource.
Source:
Returns:
Type
number

getEndTime() → {number}

Returns the segment's end time in seconds.
Source:
Returns:
Type
number

getSize() → {number}

Returns the size of the segment.
Source:
Returns:
Type
number

getStartByte() → {number}

Returns the offset from the start of the resource to the start of the segment.
Source:
Returns:
Type
number

getStartTime() → {number}

Returns the segment's start time in seconds.
Source:
Returns:
Type
number

getStatus() → {shaka.media.SegmentReference.Status}

Returns the segment's status.
Source:
Returns:
Type
shaka.media.SegmentReference.Status

getTileDuration() → {number}

Returns the segment's explicit tile duration. Only defined in image segments.
Source:
Returns:
Type
number

getTilesLayout() → {string}

Returns the segment's tiles layout. Only defined in image segments.
Source:
Returns:
Type
string

getUris() → {Array.<string>}

Creates and returns the URIs of the resource containing the segment.
Source:
Returns:
Type
Array.<string>

hasPartialSegments() → {boolean}

Returns true if it contains partial SegmentReferences.
Source:
Returns:
Type
boolean

markAsUnavailable()

Mark the reference as unavailable.
Source: