public interface Timeline
Modifier and Type | Interface and Description |
---|---|
static class |
Timeline.Type
The Timeline Type.
|
Modifier and Type | Field and Description |
---|---|
static long |
MILLISECONDS_IN_MICROS |
Modifier and Type | Method and Description |
---|---|
long |
getAbsolutePlayheadPosition(long contentPlayheadPosition)
Converts the relative content position to its absolute playhead position.
|
java.util.List<java.lang.Long> |
getAdMarkerPositions()
It returns a list of Ad markers positions with respect to the relative content timeline.
|
AdPod |
getAdPodAt(long absolutePlayheadPosition)
Returns the Ad pod at the position specified by the absolute playhead position,
if the position belongs to an Ad, or null if it belongs to content.
|
java.util.List<AdPod> |
getAdPods()
Searchs through the timeline and returns the list of Ad Pods that belongs
to those Ad Timeline Blocks.
|
long |
getContentLength()
It returns the content duration.
|
long |
getContentPlayheadPosition(long absolutePlayheadPosition)
Calculates the corresponding content playhead position given the absolute playhead position,
that is, the playhead position as if there were no Ads stitched to the content.
|
long |
getRelativePlayheadPosition(long absolutePlayheadPosition)
Calculates the relative playhead position given the absolute playhead position.
|
TimelineBlock |
getTimelineBlockAt(long absolutePlayheadPosition)
Returns the
TimelineBlock at the specified absolutePlayheadPosition. |
long |
getTotalLength()
It returns the total duration of the video.
|
Timeline.Type |
getType()
Gets the Timeline type.
|
boolean |
isPlayingAd(long absolutePlayheadPosition)
Checks the playhead position and verifies whether we are inside an Ad block or not.
|
default void |
notifyTimedAdPodFound(AdPod adPod)
Notifies this timeline that an
AdPod has been found
as timed metadata. |
default void |
reset()
Resets this timeline to its default initial value.
|
default void |
updatePlayableWindow(long minimumPlayheadPosition,
long maximumPlayheadPosition)
Updates the playable window within the Timeline.
|
static final long MILLISECONDS_IN_MICROS
Timeline.Type getType()
long getContentLength()
long getTotalLength()
long getContentPlayheadPosition(long absolutePlayheadPosition)
If the absolute playhead position corresponds to: - a pre-roll Ad, 0 will be returned. - a post-roll Ad, the content length will be returned. - a mid-roll Ad, the ad offset with respect to the content will be returned.
If the absolute playhead position is outside the bounds of the total length, 0 will be returned.
absolutePlayheadPosition
- the absolute playhead position in milliseconds.getRelativePlayheadPosition(long).
long getRelativePlayheadPosition(long absolutePlayheadPosition)
If the absolute playhead position corresponds to:
- a content block, it will return getContentPlayheadPosition(long)
.
- a single Ad block, the relative position of the Ad will be returned.
- an Ad that belongs to an Ad pod (a sequenced group of ads),
the position relative to the Ad pod will be returned.
If the absolute playhead position is outside the bounds of the total length, 0 will be returned.
absolutePlayheadPosition
- the absolute playhead position in milliseconds.getContentPlayheadPosition(long).
long getAbsolutePlayheadPosition(long contentPlayheadPosition)
The content playhead position should be greater than 0 and lower or equals than
getContentLength()
, otherwise the value will be capped to the nearest limit,
that is, negative values will be capped to 0 and values greater
than getContentLength()
will be capped to getContentLength()
.
contentPlayheadPosition
- the relative content playhead position in milliseconds.@Nullable AdPod getAdPodAt(long absolutePlayheadPosition)
if the method isPlayingAd(long)
returns true with the same playhead position,
the AdPod must not be null.
absolutePlayheadPosition
- the absolute playhead position in milliseconds.isPlayingAd(long)
java.util.List<AdPod> getAdPods()
boolean isPlayingAd(long absolutePlayheadPosition)
absolutePlayheadPosition
- the absolute playhead position in milliseconds@NonNull java.util.List<java.lang.Long> getAdMarkerPositions()
@Nullable TimelineBlock getTimelineBlockAt(long absolutePlayheadPosition)
TimelineBlock
at the specified absolutePlayheadPosition.absolutePlayheadPosition
- the absolute playhead position in milliseconds.TimelineBlock
at the specified absolutePlayheadPosition.default void updatePlayableWindow(long minimumPlayheadPosition, long maximumPlayheadPosition)
Timeline.Type.DYNAMIC
.
Note: The default implementation does nothing. It can be overridden to provide the desired implementation.
minimumPlayheadPosition
- the minimum playable positionmaximumPlayheadPosition
- the maximum playable positiondefault void notifyTimedAdPodFound(AdPod adPod)
AdPod
has been found
as timed metadata.
Note: The default implementation does nothing. It can be overridden to provide the desired implementation.
adPod
- the AdPod founddefault void reset()
Note: The default implementation does nothing. It can be overridden to provide the desired implementation.