Constructor
new PresentationTimeline(presentationStartTimenullable, presentationDelay)
Creates a PresentationTimeline.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
presentationStartTime |
number |
<nullable> |
The wall-clock time, in seconds, when the presentation started or will start. Only required for live. |
presentationDelay |
number | The delay to give the presentation, in seconds. Only required for live. |
- Source:
- See:
Members
-
(private) clockOffset_ :number
-
Type:
- number
-
(private) duration_ :number
-
Type:
- number
-
(private) maxFirstSegmentStartTime_ :number
-
Type:
- number
-
(private, nullable) maxSegmentDuration_ :number
-
Type:
- number
-
(private) presentationDelay_ :number
-
Type:
- number
-
(private, nullable) presentationStartTime_ :number
-
Type:
- number
-
(private) segmentAvailabilityDuration_ :number
-
Type:
- number
-
(private) static_ :boolean
-
Type:
- boolean
Methods
-
assertIsValid()
-
Debug only: assert that the timeline parameters make sense for the type of presentation (VOD, IPR, live).
-
getDuration() → {number}
-
Returns:
The presentation's duration in seconds. Infinity indicates that the presentation continues indefinitely.- Type
- number
-
getEarliestStart() → {number}
-
Gets the presentation's current earliest, available timestamp. This value may be greater than the presentation's current segment availability start time if segment information is missing or does not exist at the beginning of the segment availability window.
Returns:
The presentation's current earliest, available timestamp, in seconds, relative to the start of the presentation.- Type
- number
-
(private) getLiveEdge_() → {number}
-
Returns:
The current presentation time in seconds.- Type
- number
-
getSeekRangeEnd() → {number}
-
Gets the seek range end.
Returns:
- Type
- number
-
getSegmentAvailabilityDuration() → {number}
-
Gets the presentation's segment availability duration, which is the amount of time, in seconds, that the start of a segment remains available after the live-edge moves past the end of that segment. Infinity indicates that segments remain available indefinitely. For example, if your live presentation has a 5 minute DVR window and your segments are 10 seconds long then the segment availability duration should be 4 minutes and 50 seconds.
Returns:
The presentation's segment availability duration.- Type
- number
-
getSegmentAvailabilityEnd() → {number}
-
Gets the presentation's current segment availability end time. Segments starting after this time should be assumed to be unavailable.
Returns:
The current segment availability end time, in seconds, relative to the start of the presentation. Always returns the presentation's duration for video-on-demand.- Type
- number
-
getSegmentAvailabilityStart() → {number}
-
Gets the presentation's current segment availability start time. Segments ending at or before this time should be assumed to be unavailable.
Returns:
The current segment availability start time, in seconds, relative to the start of the presentation.- Type
- number
-
isInProgress() → {boolean}
-
Returns:
True if the presentation is in progress (meaning not live, but also not completely available); otherwise, return false.- Type
- boolean
-
isLive() → {boolean}
-
Returns:
True if the presentation is live; otherwise, return false.- Type
- boolean
-
notifyMaxSegmentDuration(maxSegmentDuration)
-
Gives PresentationTimeline a Stream's maximum segment duration so it can size and position the segment availability window. This function should be called once for each Stream (no more, no less), but does not have to be called if notifySegments() is called instead for a particular stream.
Parameters:
Name Type Description maxSegmentDuration
number The maximum segment duration for a particular stream. -
notifySegments(periodStartTime, referencesnon-null)
-
Gives PresentationTimeline a Stream's segments so it can size and position the segment availability window, and account for missing segment information. This function should be called once for each Stream (no more, no less).
Parameters:
Name Type Description periodStartTime
number references
Array.<!shaka.media.SegmentReference> -
setClockOffset(offset)
-
Sets the clock offset, which is the the difference between the client's clock and the server's clock, in milliseconds (i.e., serverTime = Date.now() + clockOffset).
Parameters:
Name Type Description offset
number The clock offset, in ms. -
setDuration(duration)
-
Sets the presentation's duration.
Parameters:
Name Type Description duration
number The presentation's duration in seconds. Infinity indicates that the presentation continues indefinitely. -
setSegmentAvailabilityDuration(segmentAvailabilityDuration)
-
Sets the presentation's segment availability duration. The segment availability duration should only be set for live.
Parameters:
Name Type Description segmentAvailabilityDuration
number The presentation's new segment availability duration in seconds. -
setStatic(isStatic)
-
Sets the presentation's static flag.
Parameters:
Name Type Description isStatic
boolean If true, the presentation is static, meaning all segments are available at once.