# BinarySearchSeeker.TimestampSeeker

# BinarySearchSeeker.TimestampSeeker

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

*** ** * ** ***

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

<br />

```
protected interface BinarySearchSeeker.TimestampSeeker
```

<br />

*** ** * ** ***

A seeker that looks for a given timestamp from an input.

## Summary

|                                                                       ### Public functions                                                                       |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                    | [onSeekFinished](https://developer.android.com/reference/kotlin/androidx/media3/extractor/BinarySearchSeeker.TimestampSeeker#onSeekFinished())`()` Called when a seek operation finishes.                                                                                                                                                                                                                                                                                                            |
| [BinarySearchSeeker.TimestampSearchResult](https://developer.android.com/reference/kotlin/androidx/media3/extractor/BinarySearchSeeker.TimestampSearchResult)`!` | [searchForTimestamp](https://developer.android.com/reference/kotlin/androidx/media3/extractor/BinarySearchSeeker.TimestampSeeker#searchForTimestamp(androidx.media3.extractor.ExtractorInput,long))`(input: `[ExtractorInput](https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput)`!, targetTimestamp: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Searches a limited window of the provided input for a target timestamp. |

## Public functions

### onSeekFinished

```
fun onSeekFinished(): Unit
```

Called when a seek operation finishes.  

### searchForTimestamp

```
fun searchForTimestamp(input: ExtractorInput!, targetTimestamp: Long): BinarySearchSeeker.TimestampSearchResult!
```

Searches a limited window of the provided input for a target timestamp. The size of the window is implementation specific, but should be small enough such that it's reasonable for multiple such reads to occur during a seek operation.  

|                                                      Parameters                                                       |
|-----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| `input: `[ExtractorInput](https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput)`!` | The[ExtractorInput](https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput)from which data should be peeked. |
| `targetTimestamp: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                      | The target timestamp.                                                                                                                         |

|                                                                             Returns                                                                              |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BinarySearchSeeker.TimestampSearchResult](https://developer.android.com/reference/kotlin/androidx/media3/extractor/BinarySearchSeeker.TimestampSearchResult)`!` | A[TimestampSearchResult](https://developer.android.com/reference/kotlin/androidx/media3/extractor/BinarySearchSeeker.TimestampSearchResult)that describes the result of the search. |

|                                         Throws                                          |
|-----------------------------------------------------------------------------------------|----------------------------------------------|
| [java.io.IOException](https://developer.android.com/reference/java/io/IOException.html) | If an error occurred reading from the input. |