Package com.castlabs.android.player
Interface InitialPositionProvider
-
public interface InitialPositionProviderCallback to define an initial playing position right after theTimelineis ready. This allows for runtime decision of the starting playback position, before the Player starts buffering the media. Note that setting an InitialPositionProvider will override any starting position set in thePlayerConfigpassed to thePlayerController.open(PlayerConfig)method.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_POSITIONThe default initial position.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetInitialPositionUs(Timeline timeline)Return the desired initial position in microseconds.
-
-
-
Field Detail
-
DEFAULT_POSITION
static final long DEFAULT_POSITION
The default initial position.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInitialPositionUs
long getInitialPositionUs(Timeline timeline)
Return the desired initial position in microseconds. If the default should be used, returnDEFAULT_POSITION. For DASH live streams, it isLiveConfiguration.liveEdgeLatencyMsmilliseconds away from the Live edge, while for HLS live streams it isLiveConfiguration.hlsLiveTailSegmentIndexsegments behind the live edge. For progressive streams (such as mp4 files), the timeline information will not be complete, but the returned position will still be taken into account. Note that this method will be invoked on the Player's media loader thread, and any delays introduced here will directly impact startup time. The returned position must be relative to the firstTimeline.Windowof the Timeline.- Parameters:
timeline- the computedTimeline.- Returns:
- the desired initial position in microseconds or
DEFAULT_POSITION.
-
-