Class: shaka.media.PresentationTimeline

Constructor

(export) 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
Source:

(private) duration_ :number

Type:
  • number
Source:

(private) maxFirstSegmentStartTime_ :number

Type:
  • number
Source:

(private) maxSegmentDuration_ :number

Type:
  • number
Source:

(private) presentationDelay_ :number

Type:
  • number
Source:

(private, nullable) presentationStartTime_ :number

Type:
  • number
Source:

(private) segmentAvailabilityDuration_ :number

Type:
  • number
Source:

(private) static_ :boolean

Type:
  • boolean
Source:

(private) userSeekStart_ :number

Type:
  • number
Source:

Methods

assertIsValid()

Debug only: assert that the timeline parameters make sense for the type of presentation (VOD, IPR, live).
Source:

(export) getDuration() → {number}

Source:
Returns:
The presentation's duration in seconds. Infinity indicates that the presentation continues indefinitely.
Type
number

(private) getLiveEdge_() → {number}

Source:
Returns:
The current presentation time in seconds.
Type
number

getMaxSegmentDuration() → {number}

Source:
Returns:
The presentation's max segment duration in seconds.
Type
number

(export) getPresentationStartTime() → (nullable) {number}

Source:
Returns:
The presentation's start time in seconds.
Type
number

(export) getSafeSeekRangeStart(offset) → {number}

Gets the seek range start time, offset by the given amount. This is used to ensure that we don't "fall" back out of the seek window while we are buffering.
Parameters:
Name Type Description
offset number The offset to add to the start time.
Source:
Returns:
The current seek start time, in seconds, relative to the start of the presentation.
Type
number

(export) getSeekRangeEnd() → {number}

Gets the seek range end.
Source:
Returns:
Type
number

(export) getSeekRangeStart() → {number}

Gets the seek range start time.
Source:
Returns:
Type
number

(export) getSegmentAvailabilityEnd() → {number}

Gets the presentation's current segment availability end time. Segments starting after this time should be assumed to be unavailable.
Source:
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

(export) getSegmentAvailabilityStart() → {number}

Gets the presentation's current segment availability start time. Segments ending at or before this time should be assumed to be unavailable.
Source:
Returns:
The current segment availability start time, in seconds, relative to the start of the presentation.
Type
number

(export) isInProgress() → {boolean}

Source:
Returns:
True if the presentation is in progress (meaning not live, but also not completely available); otherwise, return false.
Type
boolean

(export) isLive() → {boolean}

Source:
Returns:
True if the presentation is live; otherwise, return false.
Type
boolean

(export) 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.
Source:

(export) notifySegments(referencesnon-null, isFirstPeriod)

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
references Array.<!shaka.media.SegmentReference>
isFirstPeriod boolean
Source:

(export) offset(offset)

Offsets the segment times by the given amount.
Parameters:
Name Type Description
offset number The number of seconds to offset by. A positive number adjusts the segment times forward.
Source:

(export) setClockOffset(offset)

Sets the clock offset, which is 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.
Source:

(export) setDelay(delay)

Sets the presentation delay.
Parameters:
Name Type Description
delay number
Source:

(export) 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.
Source:

(export) 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.
Source:

(export) 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.
Source:

(export) setUserSeekStart(time)

Sets the start time of the user-defined seek range. This is only used for VOD content.
Parameters:
Name Type Description
time number
Source: