com.brightcove.ssai.timeline

## Class TimelineManager

- java.lang.Object
- - com.brightcove.player.event.AbstractComponent
  - - com.brightcove.ssai.timeline.TimelineManager

- All Implemented Interfaces:
    Component, PlaybackListener, TickerObserver

      @Emits(events="seekTo")
       @ListensFor(events="skipAd")
      public class TimelineManager
      extends AbstractComponent
      implements TickerObserver, PlaybackListener

  Manages the state of the Timeline according to player playhead position.

- - ### Field Summary

    - ### Fields inherited from class com.brightcove.player.event.AbstractComponent

      `eventEmitter, listenerTokens`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimelineManager(BaseVideoView mBaseVideoView, Timeline mTimeline)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addAdPodListener(AdPodListener adPodListener)` Adds the Ad pod listener.
    `long` | `getContentLength()` Gets the content length.
    `long` | `getCurrentAbsolutePlayheadPosition()` Gets current absolute playhead position.
    `long` | `getCurrentRelativeDuration()` Gets current relative duration.
    `long` | `getCurrentRelativePlayheadPosition()` Gets current relative playhead position.
    `Ad` | `getPlayingAd()`
    `AdPod` | `getPlayingAdPod()` Returns an AdPod if it's currently playing an Ad, otherwise returns null.
    `SeekListener` | `getSeekListener()`
    `Timeline` | `getTimeline()` Gets the timeline if available.
    `long` | `getTotalLength()` Gets the total length.
    `boolean` | `isPlayingAd()` Checks if an ad is currently being played.
    `void` | `onComplete(long duration)` Indicates when the video playback has completed.
    `void` | `onPause(long playheadPosition)` Indicates a pause event.
    `void` | `onPlay(long playheadPosition)` Indicates a play event.
    `void` | `onTick(long lastPlayheadPositionMillis, long currentPlayheadPositionMillis)` A tick represent an poll from the underlying video player.
    `boolean` | `removeAdPodListener(AdPodListener adPodListener)` Removes the Ad pod listener.
    `void` | `removeAllAdPodListeners()` Removed all Ad pod listeners.
    `void` | `reset()`

    - ### Methods inherited from class com.brightcove.player.event.AbstractComponent

      `addListener, addOnceListener, getEventEmitter, removeListener, removeListeners`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TimelineManager

          public TimelineManager(@NonNull
                                 BaseVideoView mBaseVideoView,
                                 @NonNull
                                 Timeline mTimeline)

  - ### Method Detail

    - #### getCurrentAbsolutePlayheadPosition

          public long getCurrentAbsolutePlayheadPosition()

      Gets current absolute playhead position.
      Returns:
        the current absolute playhead position

    - #### getCurrentRelativeDuration

          public long getCurrentRelativeDuration()

      Gets current relative duration.
      Returns:
        the current relative duration

    - #### getCurrentRelativePlayheadPosition

          public long getCurrentRelativePlayheadPosition()

      Gets current relative playhead position.
      Returns:
        the current relative playhead position

    - #### isPlayingAd

          public boolean isPlayingAd()

      Checks if an ad is currently being played.
      Returns:
        true if playing an ad.

    - #### getContentLength

          public long getContentLength()

      Gets the content length.
      Returns:
        the content length

    - #### getTotalLength

          public long getTotalLength()

      Gets the total length.
      Returns:
        the total length

    - #### getPlayingAdPod

          @Nullable
          public AdPod getPlayingAdPod()

      Returns an AdPod if it's currently playing an Ad, otherwise returns null.
      Returns:
        the playing Ad pod

    - #### getPlayingAd

          @Nullable
          public Ad getPlayingAd()

    - #### getTimeline

          @NonNull
          public Timeline getTimeline()

      Gets the timeline if available.
      Returns:
        the timeline

    - #### getSeekListener

          public SeekListener getSeekListener()

    - #### onTick

          public void onTick(long lastPlayheadPositionMillis,
                             long currentPlayheadPositionMillis)

      Description copied from interface: `TickerObserver`
      A tick represent an poll from the underlying video player.
      Specified by:
        `onTick` in interface `TickerObserver`
      Parameters:
        `lastPlayheadPositionMillis` - the last playhead position in milliseconds
        `currentPlayheadPositionMillis` - the current playhead position in milliseconds

    - #### addAdPodListener

          public boolean addAdPodListener(@NonNull
                                          AdPodListener adPodListener)

      Adds the Ad pod listener.
      Parameters:
        `adPodListener` - the Ad pod listener
      Returns:
        true if added successfully

    - #### removeAdPodListener

          public boolean removeAdPodListener(@NonNull
                                             AdPodListener adPodListener)

      Removes the Ad pod listener.
      Parameters:
        `adPodListener` - the Ad pod listener
      Returns:
        true if removed successfully

    - #### removeAllAdPodListeners

          public void removeAllAdPodListeners()

      Removed all Ad pod listeners.

    - #### onPlay

          public void onPlay(long playheadPosition)

      Description copied from interface: `PlaybackListener`
      Indicates a play event.
      Specified by:
        `onPlay` in interface `PlaybackListener`
      Parameters:
        `playheadPosition` - the playhead position

    - #### onPause

          public void onPause(long playheadPosition)

      Description copied from interface: `PlaybackListener`
      Indicates a pause event.
      Specified by:
        `onPause` in interface `PlaybackListener`
      Parameters:
        `playheadPosition` - the playhead position

    - #### onComplete

          public void onComplete(long duration)

      Description copied from interface: `PlaybackListener`
      Indicates when the video playback has completed.
      Specified by:
        `onComplete` in interface `PlaybackListener`
      Parameters:
        `duration` - the duration

    - #### reset

          public void reset()