# SeekParameters

# SeekParameters

Artifact:[androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/SeekParameters.java+class:androidx.media3.exoplayer.SeekParameters)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters "View this page in Java")

<br />

```
@UnstableApi
class SeekParameters
```

<br />

*** ** * ** ***

Parameters that apply to seeking.

The predefined[EXACT](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#EXACT()),[CLOSEST_SYNC](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#CLOSEST_SYNC()),[PREVIOUS_SYNC](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#PREVIOUS_SYNC())and[NEXT_SYNC](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#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](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#toleranceBeforeUs())) and after ([toleranceAfterUs](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#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](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters)`!` | [CLOSEST_SYNC](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#CLOSEST_SYNC()) Parameters for seeking to the closest sync point.                                        |
| `const `[SeekParameters](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters)`!` | [DEFAULT](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#DEFAULT()) Default parameters.                                                                                |
| `const `[SeekParameters](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters)`!` | [EXACT](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#EXACT()) Parameters for exact seeking.                                                                          |
| `const `[SeekParameters](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters)`!` | [NEXT_SYNC](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#NEXT_SYNC()) Parameters for seeking to the sync point immediately after a requested seek position.          |
| `const `[SeekParameters](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters)`!` | [PREVIOUS_SYNC](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#PREVIOUS_SYNC()) Parameters for seeking to the sync point immediately before a requested seek position. |

|                                                                                                                                                           ### Public constructors                                                                                                                                                            |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SeekParameters](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#SeekParameters(long,long))`(toleranceBeforeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`, toleranceAfterUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` |

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#equals(java.lang.Object))`(obj: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)`                                                                                                                                                                                                                                                                                                                                                       |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [hashCode](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#hashCode())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)       | [resolveSeekPositionUs](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#resolveSeekPositionUs(long,long,long))`(` ` positionUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` firstSyncUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` secondSyncUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) `)` Resolves a seek based on the parameters, given the requested seek position and two candidate sync points. |

|                             ### Public properties                             |
|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [toleranceAfterUs](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#toleranceAfterUs()) The maximum time that the actual position seeked to may exceed the requested seek position, in microseconds.    |
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [toleranceBeforeUs](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/SeekParameters#toleranceBeforeUs()) 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.  

### DEFAULT

```
const val DEFAULT: SeekParameters!
```

Default parameters.  

### EXACT

```
const val EXACT: SeekParameters!
```

Parameters for exact seeking.  

### 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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The maximum time that the actual position seeked to may precede the requested seek position, in microseconds. Must be non-negative. |
| `toleranceAfterUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)  | The maximum time that the actual position seeked to may exceed the requested seek position, in microseconds. Must be non-negative.  |

## Public functions

### equals

```
fun equals(obj: Any?): Boolean
```  

### hashCode

```
fun hashCode(): Int
```  

### 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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)   | The requested seek position, in microseconds.                                                           |
| `firstSyncUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)  | The first candidate seek point, in microseconds.                                                        |
| `secondSyncUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The second candidate seek point, in microseconds. May equal` firstSyncUs`if there's only one candidate. |

|                                    Returns                                    |
|-------------------------------------------------------------------------------|----------------------------------------------|
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | 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.