public class TimelineManager extends java.lang.Object implements TickerObserver, PlaybackListener
| Constructor and Description |
|---|
TimelineManager(Timeline mTimeline) |
| 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.
|
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() |
public TimelineManager(@NonNull
Timeline mTimeline)
public long getCurrentAbsolutePlayheadPosition()
public long getCurrentRelativeDuration()
public long getCurrentRelativePlayheadPosition()
public boolean isPlayingAd()
public long getContentLength()
public long getTotalLength()
@Nullable public AdPod getPlayingAdPod()
@Nullable public Ad getPlayingAd()
@NonNull public Timeline getTimeline()
public void onTick(long lastPlayheadPositionMillis,
long currentPlayheadPositionMillis)
TickerObserveronTick in interface TickerObserverlastPlayheadPositionMillis - the last playhead position in millisecondscurrentPlayheadPositionMillis - the current playhead position in millisecondspublic boolean addAdPodListener(@NonNull
AdPodListener adPodListener)
adPodListener - the Ad pod listenerpublic boolean removeAdPodListener(@NonNull
AdPodListener adPodListener)
adPodListener - the Ad pod listenerpublic void removeAllAdPodListeners()
public void onPlay(long playheadPosition)
PlaybackListeneronPlay in interface PlaybackListenerplayheadPosition - the playhead positionpublic void onPause(long playheadPosition)
PlaybackListeneronPause in interface PlaybackListenerplayheadPosition - the playhead positionpublic void onComplete(long duration)
PlaybackListeneronComplete in interface PlaybackListenerduration - the durationpublic void reset()