Class AdBreak

java.lang.Object
com.brightcove.ssai.ad.AdBreak

public class AdBreak extends Object
Representation of an AdBreak.
  • Method Details

    • create

      public static <T> AdBreak create(Long adsOffset, @NonNull T input, @NonNull Function2<T,Long,AdBreak> mapper) throws Exception
      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

      public static AdBreak create(long startPosition, long endPosition, @NonNull Collection<Ad> ads)
      Creates an AdBreak with startPosition, endPosition and ads.
      Parameters:
      startPosition - startPosition of the AdBreak
      endPosition - endPosition of the AdBreak.
      ads - Collection of Ad.
      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 id
      startPosition - startPosition of the AdBreak
      endPosition - endPosition of the AdBreak.
      ads - Collection of Ad.
      Returns:
      the instantiated AdBreak.
    • createSlate

      public static AdBreak createSlate(long absoluteStartPositionMs, long absoluteEndPositionMs)
      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 milliseconds
      absoluteEndPositionMs - 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

      public String getId()
    • getAds

      @NonNull public Collection<Ad> getAds()
      Returns the ads of the AdBreak.
      Returns:
      the ads of the AdBreak.
    • getAdAt

      @Nullable public Ad<?> getAdAt(long currentAbsolutePosition)
      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: