Class AdBlock

  • All Implemented Interfaces:
    TimelineBlock

    public class AdBlock
    extends java.lang.Object
    implements TimelineBlock
    A timeline block representing an Ad.
    • Constructor Summary

      Constructors 
      Constructor Description
      AdBlock​(AdPod adPod)
      Instantiates a new Ad block.
      AdBlock​(AdPod adPod, boolean isDynamic)
      Instantiates a new Ad block.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getAbsoluteOffset()
      Gets the absolute Block offset in milliseconds, that is, the offset with respect to the total video length (content + ads).
      AdPod getAdPod()
      If TimelineBlock.isAd() returns true, use this method to get additional information about the Ad Pod.
      long getDuration()
      Gets the duration of the block in milliseconds.
      long getRelativeOffset()
      Gets the relative Block offset in milliseconds, that is, the offset with respect to the content length only (no Ads).
      boolean isAd()
      Specify if the block is an Ad.
      boolean isDynamic()
      Returns whether the Timeline block is dynamic or not.
      java.lang.String toString()  
      void updateAbsoluteOffset​(long absoluteOffset)
      Updates the absolute offset of this block.
      void updateAdPod​(AdPod adPod)
      Updates the AdPod of this block.
      void updateDuration​(long duration)
      Updates the duration of this block.
      void updateRelativeOffset​(long relativeOffset)
      Updates the relative offset of this block.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AdBlock

        public AdBlock​(@NonNull
                       AdPod adPod)
        Instantiates a new Ad block.
      • AdBlock

        public AdBlock​(@NonNull
                       AdPod adPod,
                       boolean isDynamic)
        Instantiates a new Ad block.
    • Method Detail

      • getDuration

        public long getDuration()
        Description copied from interface: TimelineBlock
        Gets the duration of the block in milliseconds.
        Specified by:
        getDuration in interface TimelineBlock
        Returns:
        the duration.
      • getAbsoluteOffset

        public long getAbsoluteOffset()
        Description copied from interface: TimelineBlock
        Gets the absolute Block offset in milliseconds, that is, the offset with respect to the total video length (content + ads).
        Specified by:
        getAbsoluteOffset in interface TimelineBlock
        Returns:
        the offset in milliseconds.
      • getRelativeOffset

        public long getRelativeOffset()
        Description copied from interface: TimelineBlock
        Gets the relative Block offset in milliseconds, that is, the offset with respect to the content length only (no Ads).
        Specified by:
        getRelativeOffset in interface TimelineBlock
        Returns:
        the offset in milliseconds.
      • isAd

        public boolean isAd()
        Description copied from interface: TimelineBlock
        Specify if the block is an Ad.
        Specified by:
        isAd in interface TimelineBlock
        Returns:
        true if an Ad.
      • isDynamic

        public boolean isDynamic()
        Description copied from interface: TimelineBlock
        Returns whether the Timeline block is dynamic or not.

        Note: The default implementation returns false.

        Specified by:
        isDynamic in interface TimelineBlock
        Returns:
        true if it is dynamic
      • updateDuration

        public void updateDuration​(long duration)
        Description copied from interface: TimelineBlock
        Updates the duration of this block. This block must only be updated when TimelineBlock.isDynamic() returns true.

        Note: The default implementation does nothing. It can be overridden to provide the desired implementation.

        Specified by:
        updateDuration in interface TimelineBlock
        Parameters:
        duration - the new duration
      • updateAbsoluteOffset

        public void updateAbsoluteOffset​(long absoluteOffset)
        Description copied from interface: TimelineBlock
        Updates the absolute offset of this block. This block must only be updated when TimelineBlock.isDynamic() returns true.

        Note: The default implementation does nothing. It can be overridden to provide the desired implementation.

        Specified by:
        updateAbsoluteOffset in interface TimelineBlock
        Parameters:
        absoluteOffset - the new absolute offset
      • updateRelativeOffset

        public void updateRelativeOffset​(long relativeOffset)
        Description copied from interface: TimelineBlock
        Updates the relative offset of this block. This block must only be updated when TimelineBlock.isDynamic() returns true.

        Note: The default implementation does nothing. It can be overridden to provide the desired implementation.

        Specified by:
        updateRelativeOffset in interface TimelineBlock
        Parameters:
        relativeOffset - the new relative offset
      • updateAdPod

        public void updateAdPod​(@NonNull
                                AdPod adPod)
        Description copied from interface: TimelineBlock
        Updates the AdPod of this block. This block must only be updated when TimelineBlock.isDynamic() returns true.

        Note: The default implementation does nothing. It can be overridden to provide the desired implementation.

        Specified by:
        updateAdPod in interface TimelineBlock
        Parameters:
        adPod - the new AdPod
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object