Class AdBreak


  • public class AdBreak
    extends java.lang.Object
    Representation of an AdBreak.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static AdBreak create​(long startPosition, long endPosition, java.util.Collection<Ad> ads)
      Creates an AdBreak with startPosition, endPosition and ads.
      static <T> AdBreak create​(java.lang.Long adsOffset, T input, Function2<T,​java.lang.Long,​AdBreak> mapper)
      Creates an AdBreak from a T type object.
      static AdBreak create​(java.lang.String id, long startPosition, long endPosition, java.util.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 getAbsoluteEndPosition()
      Returns the absolute end position of the AdBreak.
      long getAbsoluteStartPosition()
      Returns the absolute start position of the AdBreak.
      Ad<?> getAdAt​(long currentAbsolutePosition)  
      java.util.Collection<Ad> getAds()
      Returns the ads of the AdBreak.
      long getDuration()
      Returns the duration of the AdBreak.
      java.lang.String getId()  
      boolean isSlate()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • create

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

        public static AdBreak create​(long startPosition,
                                     long endPosition,
                                     @NonNull
                                     java.util.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
                                     java.lang.String id,
                                     long startPosition,
                                     long endPosition,
                                     @NonNull
                                     java.util.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 java.lang.String getId()
      • getAds

        @NonNull
        public java.util.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.