Package com.brightcove.ssai.ad
Class AdBreak
java.lang.Object
com.brightcove.ssai.ad.AdBreak
Representation of an AdBreak.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AdBreak
create
(long startPosition, long endPosition, Collection<Ad> ads) Creates an AdBreak with startPosition, endPosition and ads.static <T> AdBreak
Creates an AdBreak from a T type object.static AdBreak
create
(String id, long startPosition, long endPosition, Collection<Ad> ads) Creates an AdBreak with an Id, startPosition, endPosition and ads.static AdBreak
createSlate
(long absoluteStartPositionMs, long absoluteEndPositionMs) Creates an Slate Ad Break.long
Returns the absolute end position of the AdBreak.long
Returns the absolute start position of the AdBreak.Ad<?>
getAdAt
(long currentAbsolutePosition) getAds()
Returns the ads of the AdBreak.long
Returns the duration of the AdBreak.getId()
boolean
isSlate()
-
Method Details
-
create
public static <T> AdBreak create(Long adsOffset, @NonNull T input, @NonNull Function2<T, Long, throws ExceptionAdBreak> mapper) Creates an AdBreak from a T type object.- Type Parameters:
T
- Type of the input.- Parameters:
adsOffset
- Initial offset of the AdBreak.input
- object to map from.mapper
- Function implementation to map.- Returns:
- an AdBreak mapped from input with mapper.
- Throws:
Exception
-
create
Creates an AdBreak with startPosition, endPosition and ads.- Parameters:
startPosition
- startPosition of the AdBreakendPosition
- endPosition of the AdBreak.ads
- Collection ofAd
.- Returns:
- the instantiated AdBreak.
-
create
public static AdBreak create(@NonNull String id, long startPosition, long endPosition, @NonNull Collection<Ad> ads) Creates an AdBreak with an Id, startPosition, endPosition and ads.- Parameters:
id
- the AdBreak idstartPosition
- startPosition of the AdBreakendPosition
- endPosition of the AdBreak.ads
- Collection ofAd
.- Returns:
- the instantiated AdBreak.
-
createSlate
Creates an Slate Ad Break. An Slate Ad Break is an AdBreak containing one linear ad that will only return a valid absolute start position, absolute end position, and duration. All values are in milliseconds. The remaining values will return empty for non nullable values, or null otherwise.- Parameters:
absoluteStartPositionMs
- the absolute Ad start position in millisecondsabsoluteEndPositionMs
- the absolute Ad end position in milliseconds- Returns:
- the slate Ad Break
-
getAbsoluteStartPosition
public long getAbsoluteStartPosition()Returns the absolute start position of the AdBreak.- Returns:
- the absolute start position of the AdBreak.
-
getAbsoluteEndPosition
public long getAbsoluteEndPosition()Returns the absolute end position of the AdBreak.- Returns:
- the absolute end position of the AdBreak.
-
getDuration
public long getDuration()Returns the duration of the AdBreak.- Returns:
- the duration of the AdBreak.
-
getId
-
getAds
Returns the ads of the AdBreak.- Returns:
- the ads of the AdBreak.
-
getAdAt
- Parameters:
currentAbsolutePosition
- the playhead absolute position.- Returns:
- the ad at currentAbsolutePosition, null if there is no ad playing at currentAbsolutePosition.
-
isSlate
public boolean isSlate()- Returns:
- true if this AdBreak is a Slate.
- See Also:
-