SeekParameters
@UnstableApi
class SeekParameters
Parameters that apply to seeking.
The predefined EXACT, CLOSEST_SYNC, PREVIOUS_SYNC and NEXT_SYNC parameters are suitable for most use cases. Seeking to sync points is typically faster but less accurate than exact seeking.
In the general case, an instance specifies a maximum tolerance before (toleranceBeforeUs) and after (toleranceAfterUs) a requested seek position (x). If one or more sync points falls within the window [x - toleranceBeforeUs, x +
toleranceAfterUs] then the seek will be performed to the sync point within the window that's closest to x. If no sync point falls within the window then the seek will be performed to x - toleranceBeforeUs. Internally the player may need to seek to an earlier sync point and discard media until this position is reached.
Summary
Constants |
|
|---|---|
const SeekParameters! |
Parameters for seeking to the closest sync point. |
const SeekParameters! |
Default parameters. |
const SeekParameters! |
Parameters for exact seeking. |
const SeekParameters! |
Parameters for seeking to the sync point immediately after a requested seek position. |
const SeekParameters! |
Parameters for seeking to the sync point immediately before a requested seek position. |
Public constructors |
|---|
SeekParameters(toleranceBeforeUs: Long, toleranceAfterUs: Long) |
Public functions |
|
|---|---|
Boolean |
|
Int |
hashCode() |
Long |
resolveSeekPositionUs(Resolves a seek based on the parameters, given the requested seek position and two candidate sync points. |
Public properties |
|
|---|---|
Long |
The maximum time that the actual position seeked to may exceed the requested seek position, in microseconds. |
Long |
The maximum time that the actual position seeked to may precede the requested seek position, in microseconds. |
Constants
CLOSEST_SYNC
const val CLOSEST_SYNC: SeekParameters!
Parameters for seeking to the closest sync point.
NEXT_SYNC
const val NEXT_SYNC: SeekParameters!
Parameters for seeking to the sync point immediately after a requested seek position.
PREVIOUS_SYNC
const val PREVIOUS_SYNC: SeekParameters!
Parameters for seeking to the sync point immediately before a requested seek position.
Public constructors
SeekParameters
SeekParameters(toleranceBeforeUs: Long, toleranceAfterUs: Long)
| Parameters | |
|---|---|
toleranceBeforeUs: Long |
The maximum time that the actual position seeked to may precede the requested seek position, in microseconds. Must be non-negative. |
toleranceAfterUs: Long |
The maximum time that the actual position seeked to may exceed the requested seek position, in microseconds. Must be non-negative. |
Public functions
resolveSeekPositionUs
fun resolveSeekPositionUs(
positionUs: Long,
firstSyncUs: Long,
secondSyncUs: Long
): Long
Resolves a seek based on the parameters, given the requested seek position and two candidate sync points.
| Parameters | |
|---|---|
positionUs: Long |
The requested seek position, in microseconds. |
firstSyncUs: Long |
The first candidate seek point, in microseconds. |
secondSyncUs: Long |
The second candidate seek point, in microseconds. May equal |
| Returns | |
|---|---|
Long |
The resolved seek position, in microseconds. |
Public properties
toleranceAfterUs
val toleranceAfterUs: Long
The maximum time that the actual position seeked to may exceed the requested seek position, in microseconds.
toleranceBeforeUs
val toleranceBeforeUs: Long
The maximum time that the actual position seeked to may precede the requested seek position, in microseconds.