Constructor
new SegmentReference(startTime, endTime, uris, startByte, endBytenullable, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferencesopt, non-null, tilesLayoutopt, nullable, tileDurationopt, nullable, syncTimeopt, nullable, statusopt, aesKeyopt, nullable, allPartialSegmentsopt)
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 the start time of the most recent discontinuity, or 0 if there is no preceding discontinuity. Only used in segments mode. |
||
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. | |
aesKey |
shaka.extern.aesKey |
<optional> <nullable> |
null | The segment's AES-128-CBC full segment encryption key and iv. |
allPartialSegments |
boolean |
<optional> |
false | Indicate if the segment has all partial segments |
- 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:
getUrisInner :function(): !Array.<string>
Type:
- function(): !Array.<string>
- Source:
partialReferences :Array.<!shaka.media.SegmentReference>
Type:
- Array.<!shaka.media.SegmentReference>
- Source:
segmentData :BufferSource|null
Type:
- BufferSource | null
- 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:
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
getSegmentData() → {BufferSource}
Return the segment data.
- Source:
Returns:
- Type
- BufferSource
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
getThumbnailSprite() → {shaka.extern.ThumbnailSprite}
Returns the segment's thumbnail sprite.
- Source:
Returns:
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>
hasAllPartialSegments() → {boolean}
Returns true if it contains all partial SegmentReferences.
- Source:
Returns:
- Type
- boolean
hasByterangeOptimization() → {boolean}
Returns true if the segment has a byterange optimization.
- Source:
Returns:
- Type
- boolean
hasPartialSegments() → {boolean}
Returns true if it contains partial SegmentReferences.
- Source:
Returns:
- Type
- boolean
isIndependent() → {boolean}
Returns true if the segment is independent.
- Source:
Returns:
- Type
- boolean
isLastPartial() → {boolean}
Returns true if reference as being the last part of the full segment.
- Source:
Returns:
- Type
- boolean
isPartial() → {boolean}
Returns true if the segment is partial.
- Source:
Returns:
- Type
- boolean
isPreload() → {boolean}
Returns true if the segment is preloaded.
- Source:
Returns:
- Type
- boolean
markAsByterangeOptimization()
Mark the reference as byterange optimization.
The "byterange optimization" means that it is playable using MP4 low
latency streaming with chunked data.
- Source:
markAsLastPartial()
Mark the reference as being the last part of the full segment
- Source:
markAsNonIndependent()
Mark the reference as non-independent.
- Source:
markAsUnavailable()
Mark the reference as unavailable.
- Source:
offset(offset)
Offset the segment reference by a fixed amount.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | The amount to add to the segment's start and end times. |
- Source:
setSegmentData(segmentDatanon-null)
Set the segment data.
Parameters:
Name | Type | Description |
---|---|---|
segmentData |
BufferSource |
- Source:
setThumbnailSprite(thumbnailSprite)
Set the segment's thumbnail sprite.
Parameters:
Name | Type | Description |
---|---|---|
thumbnailSprite |
shaka.extern.ThumbnailSprite |
- Source:
syncAgainst(lowestSyncTime)
Sync this segment against a particular sync time that will serve as "0" in
the presentation timeline.
Parameters:
Name | Type | Description |
---|---|---|
lowestSyncTime |
number |
- Source:
updateInitSegmentReference(initSegmentReference)
Updates the init segment reference and propagates the update to all partial
references.
Parameters:
Name | Type | Description |
---|---|---|
initSegmentReference |
shaka.media.InitSegmentReference |
- Source:
Type Definitions
ThumbnailSprite
Type:
- {height: number, positionX: number, positionY: number, width: number}
Properties:
Name | Type | Description |
---|---|---|
height |
number | The thumbnail height in px. |
positionX |
number | The thumbnail left position in px. |
positionY |
number | The thumbnail top position in px. |
width |
number | The thumbnail width in px. |
- Source: