-
public interface Timeline
The Timeline interface is a representation of a single SSAI video, that is, a video with its Ads stitched in the video itself.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enum
Timeline.Type
The Timeline Type.
-
Method Summary
Modifier and Type Method Description abstract Timeline.Type
getType()
Gets the Timeline type. abstract long
getContentLength()
It returns the content duration. abstract long
getTotalLength()
It returns the total duration of the video.It includes the duration of the content plus the duration of thestitched Ad videos. abstract 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. abstract long
getRelativePlayheadPosition(long absolutePlayheadPosition)
Calculates the relative playhead position given the absolute playhead position. abstract long
getAbsolutePlayheadPosition(long contentPlayheadPosition)
Converts the relative content position to its absolute playhead position. abstract 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. abstract List<AdPod>
getAdPods()
Searchs through the timeline and returns the list of Ad Pods that belongsto those Ad Timeline Blocks. abstract boolean
isPlayingAd(long absolutePlayheadPosition)
Checks the playhead position and verifies whether we are inside an Ad block or not. abstract List<Long>
getAdMarkerPositions()
It returns a list of Ad markers positions with respect to the relative content timeline. abstract TimelineBlock
getTimelineBlockAt(long absolutePlayheadPosition)
Returns the TimelineBlock at the specified absolutePlayheadPosition. void
updatePlayableWindow(long minimumPlayheadPosition, long maximumPlayheadPosition)
Updates the playable window within the Timeline. void
notifyTimedAdPodFound(AdPod adPod)
Notifies this timeline that an AdPod has been foundas timed metadata. void
reset()
Resets this timeline to its default initial value. -
-
Method Detail
-
getType
abstract Timeline.Type getType()
Gets the Timeline type.
-
getContentLength
abstract long getContentLength()
It returns the content duration. Also known as relative duration.This is the duration of the original content without the duration of thestitched Ad videos.
-
getTotalLength
abstract long getTotalLength()
It returns the total duration of the video.It includes the duration of the content plus the duration of thestitched Ad videos.
-
getContentPlayheadPosition
abstract 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.
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.
- Parameters:
absolutePlayheadPosition
- the absolute playhead position in milliseconds.
-
getRelativePlayheadPosition
abstract long getRelativePlayheadPosition(long absolutePlayheadPosition)
Calculates the relative playhead position given the absolute playhead position.
If the absolute playhead position corresponds to:- a content block, it will return getContentPlayheadPosition.- 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.
- Parameters:
absolutePlayheadPosition
- the absolute playhead position in milliseconds.
-
getAbsolutePlayheadPosition
abstract long getAbsolutePlayheadPosition(long contentPlayheadPosition)
Converts the relative content position to its absolute playhead position.
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 greaterthan getContentLength will be capped to getContentLength.
- Parameters:
contentPlayheadPosition
- the relative content playhead position in milliseconds.
-
getAdPodAt
@Nullable() abstract 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.
if the method isPlayingAd returns true with the same playhead position,the AdPod must not be null.
- Parameters:
absolutePlayheadPosition
- the absolute playhead position in milliseconds.
-
getAdPods
abstract List<AdPod> getAdPods()
Searchs through the timeline and returns the list of Ad Pods that belongsto those Ad Timeline Blocks.
-
isPlayingAd
abstract boolean isPlayingAd(long absolutePlayheadPosition)
Checks the playhead position and verifies whether we are inside an Ad block or not.
- Parameters:
absolutePlayheadPosition
- the absolute playhead position in milliseconds
-
getAdMarkerPositions
@NonNull() abstract List<Long> getAdMarkerPositions()
It returns a list of Ad markers positions with respect to the relative content timeline.
-
getTimelineBlockAt
@Nullable() abstract TimelineBlock getTimelineBlockAt(long absolutePlayheadPosition)
Returns the TimelineBlock at the specified absolutePlayheadPosition.
- Parameters:
absolutePlayheadPosition
- the absolute playhead position in milliseconds.
-
updatePlayableWindow
void updatePlayableWindow(long minimumPlayheadPosition, long maximumPlayheadPosition)
Updates the playable window within the Timeline.This method only applies for Timelines of type DYNAMIC.
Note: The default implementation does nothing. It can be overridden to provide thedesired implementation.
- Parameters:
minimumPlayheadPosition
- the minimum playable positionmaximumPlayheadPosition
- the maximum playable position
-
notifyTimedAdPodFound
void notifyTimedAdPodFound(AdPod adPod)
Notifies this timeline that an AdPod has been foundas timed metadata.
Note: The default implementation does nothing. It can be overridden to provide thedesired implementation.
- Parameters:
adPod
- the AdPod found
-
reset
void reset()
Resets this timeline to its default initial value.
Note: The default implementation does nothing. It can be overridden to provide thedesired implementation.
-
-
-
-