# SeekMap

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/SeekMap.java+class:androidx.media3.extractor.SeekMap)

*** ** * ** ***


```
@UnstableApi
public interface SeekMap
```

<br />

Known direct subclasses [BinarySearchSeeker.BinarySearchSeekMap](https://developer.android.com/reference/androidx/media3/extractor/BinarySearchSeeker.BinarySearchSeekMap), [ChunkIndex](https://developer.android.com/reference/androidx/media3/extractor/ChunkIndex), [ConstantBitrateSeekMap](https://developer.android.com/reference/androidx/media3/extractor/ConstantBitrateSeekMap), [FlacSeekTableSeekMap](https://developer.android.com/reference/androidx/media3/extractor/FlacSeekTableSeekMap), [ForwardingSeekMap](https://developer.android.com/reference/androidx/media3/extractor/ForwardingSeekMap), [IndexSeekMap](https://developer.android.com/reference/androidx/media3/extractor/IndexSeekMap), [SeekMap.Unseekable](https://developer.android.com/reference/androidx/media3/extractor/SeekMap.Unseekable), [SingleSampleSeekMap](https://developer.android.com/reference/androidx/media3/extractor/SingleSampleSeekMap), [TrackAwareSeekMap](https://developer.android.com/reference/androidx/media3/extractor/TrackAwareSeekMap)

|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/BinarySearchSeeker.BinarySearchSeekMap` | A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` implementation that returns the estimated byte location from `https://developer.android.com/reference/androidx/media3/extractor/BinarySearchSeeker.SeekOperationParams#calculateNextSearchBytePosition(long,long,long,long,long,long)` for each `https://developer.android.com/reference/androidx/media3/extractor/BinarySearchSeeker.BinarySearchSeekMap#getSeekPoints(long)` query. |
| `https://developer.android.com/reference/androidx/media3/extractor/ChunkIndex` | Defines chunks of samples within a media stream. |
| `https://developer.android.com/reference/androidx/media3/extractor/ConstantBitrateSeekMap` | A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` implementation that assumes the stream has a constant bitrate and consists of multiple independent frames of the same size. |
| `https://developer.android.com/reference/androidx/media3/extractor/FlacSeekTableSeekMap` | A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` implementation for FLAC streams that contain a [seek table](https://www.rfc-editor.org/rfc/rfc9639.html#name-seek-table). |
| `https://developer.android.com/reference/androidx/media3/extractor/ForwardingSeekMap` | A forwarding class for `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` |
| `https://developer.android.com/reference/androidx/media3/extractor/IndexSeekMap` | A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` implementation based on a mapping between times and positions in the input stream. |
| `https://developer.android.com/reference/androidx/media3/extractor/SeekMap.Unseekable` | A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` that does not support seeking. |
| `https://developer.android.com/reference/androidx/media3/extractor/SingleSampleSeekMap` | A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` implementation that maps the given point back onto itself. |
| `https://developer.android.com/reference/androidx/media3/extractor/TrackAwareSeekMap` | A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` that also allows seeking based on a specific track ID. |

*** ** * ** ***

Maps seek positions (in microseconds) to corresponding positions (byte offsets) in the stream.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/extractor/SeekMap.SeekPoints` Contains one or two `https://developer.android.com/reference/androidx/media3/extractor/SeekPoint`s. |
| `public class https://developer.android.com/reference/androidx/media3/extractor/SeekMap.Unseekable implements https://developer.android.com/reference/androidx/media3/extractor/SeekMap` A `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` that does not support seeking. |

| ### Public methods |
|---|---|
| `abstract long` | `https://developer.android.com/reference/androidx/media3/extractor/SeekMap#getDurationUs()()` Returns the duration of the stream in microseconds. |
| `abstract https://developer.android.com/reference/androidx/media3/extractor/SeekMap.SeekPoints` | `https://developer.android.com/reference/androidx/media3/extractor/SeekMap#getSeekPoints(long)(long timeUs)` Obtains seek points for the specified seek time in microseconds. |
| `default boolean` | `https://developer.android.com/reference/androidx/media3/extractor/SeekMap#isEstimated()()` Returns whether this `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` is based on estimations. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/extractor/SeekMap#isSeekable()()` Returns whether seeking is supported. |

## Public methods

### getDurationUs

```
abstract long getDurationUs()
```

Returns the duration of the stream in microseconds.

| Returns |
|---|---|
| `long` | The duration of the stream in microseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the duration is unknown. |

### getSeekPoints

```
abstract SeekMap.SeekPoints getSeekPoints(long timeUs)
```

Obtains seek points for the specified seek time in microseconds. The returned `https://developer.android.com/reference/androidx/media3/extractor/SeekMap.SeekPoints` will contain one or two distinct seek points.

Two seek points \[A, B\] are returned in the case that seeking can only be performed to discrete points in time, there does not exist a seek point at exactly the requested time, and there exist seek points on both sides of it. In this case A and B are the closest seek points before and after the requested time. A single seek point is returned in all other cases.

| Parameters |
|---|---|
| `long timeUs` | A seek time in microseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/SeekMap.SeekPoints` | The corresponding seek points. |

### isEstimated

```
default boolean isEstimated()
```

Returns whether this `https://developer.android.com/reference/androidx/media3/extractor/SeekMap` is based on estimations. The default value is `
false`.

An example of this is depending on the declared byte length of a stream or file, rather than a media byte length derived from metadata from within the stream itself.

### isSeekable

```
abstract boolean isSeekable()
```

Returns whether seeking is supported.

| Returns |
|---|---|
| `boolean` | Whether seeking is supported. |