You can obtain a description of the timeline associated with the currently selected item that is being played by the PSDK. This is most useful when your application displays a custom scrub-bar control in which the content sections that correspond to ad content are identified.
The Timeline class encapsulates the information related to the contents of the timeline associated with the media item that is currently loaded by the MediaPlayer instance. The Timeline class gives access to a read-only view of the underlying timeline. The Timeline class provides a getter method that provides an iterator through a list of TimelineMarker objects.
A TimelineMarker object contains two pieces of information:
// access the timeline object Timeline timeline = mediaPlayer.getTimeline(); // iterate through the list of TimelineMarkers Iterator<TimelineMarker> iterator = timeline.timelineMarkers(); while (iterator.hasNext()) { TimelineMarker marker = iterator.next(); // the start position of the marker long startPos = marker.getTime(); // the duration of the marker long duration = marker.getDuration(); }