# ConstantBitrateSeekMap

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

*** ** * ** ***


```
@UnstableApi
class ConstantBitrateSeekMap : SeekMap
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/media3/extractor/SeekMap` implementation that assumes the stream has a constant bitrate and consists of multiple independent frames of the same size. Seek points are calculated to be at frame boundaries.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#ConstantBitrateSeekMap(long,long,int,int)( inputLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, firstFrameBytePosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, bitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, frameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates an instance with `allowSeeksIfLengthUnknown` set to `false`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#ConstantBitrateSeekMap(long,long,int,int,boolean)( inputLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, firstFrameBytePosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, bitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, frameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, allowSeeksIfLengthUnknown: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Creates an instance. |

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#ConstantBitrateSeekMap(long,long,int,int,boolean,boolean)( inputLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, firstFrameBytePosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, bitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, frameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, allowSeeksIfLengthUnknown: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isEstimated: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Creates an instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/SeekMap.SeekPoints!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#getSeekPoints(long)(timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Obtains seek points for the specified seek time in microseconds. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#getTimeUsAtPosition(long)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns the stream time in microseconds for a given position. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#isSeekable()()` Returns whether seeking is supported. |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#getFirstFramePosition()()` Returns the byte position of the first frame in the stream (as passed to the constructor). |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#shouldAllowSeeksIfLengthUnknown()()` Returns whether seeking is permitted if the stream length is unknown (as passed to the constructor). |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#durationUs()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#isEstimated()` |

| ### Protected properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#bitrate()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap#frameSize()` |

## Public constructors

### ConstantBitrateSeekMap

```
ConstantBitrateSeekMap(
    inputLength: Long,
    firstFrameBytePosition: Long,
    bitrate: Int,
    frameSize: Int
)
```

Creates an instance with `allowSeeksIfLengthUnknown` set to `false`.

| Parameters |
|---|---|
| `inputLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The length of the stream in bytes, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()` if unknown. |
| `firstFrameBytePosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The byte-position of the first frame in the stream. |
| `bitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The bitrate (which is assumed to be constant in the stream). |
| `frameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The size of each frame in the stream in bytes. May be `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()` if unknown. |

### ConstantBitrateSeekMap

```
ConstantBitrateSeekMap(
    inputLength: Long,
    firstFrameBytePosition: Long,
    bitrate: Int,
    frameSize: Int,
    allowSeeksIfLengthUnknown: Boolean
)
```

Creates an instance.

| Parameters |
|---|---|
| `inputLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The length of the stream in bytes, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()` if unknown. |
| `firstFrameBytePosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The byte-position of the first frame in the stream. |
| `bitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The bitrate (which is assumed to be constant in the stream). |
| `frameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The size of each frame in the stream in bytes. May be `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()` if unknown. |
| `allowSeeksIfLengthUnknown: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to allow seeking even if the length of the content is unknown. |

## Protected constructors

### ConstantBitrateSeekMap

```
protected ConstantBitrateSeekMap(
    inputLength: Long,
    firstFrameBytePosition: Long,
    bitrate: Int,
    frameSize: Int,
    allowSeeksIfLengthUnknown: Boolean,
    isEstimated: Boolean
)
```

Creates an instance.

| Parameters |
|---|---|
| `inputLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The length of the stream in bytes, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()` if unknown. |
| `firstFrameBytePosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The byte-position of the first frame in the stream. |
| `bitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The bitrate (which is assumed to be constant in the stream). |
| `frameSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The size of each frame in the stream in bytes. May be `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()` if unknown. |
| `allowSeeksIfLengthUnknown: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to allow seeking even if the length of the content is unknown. |
| `isEstimated: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether this `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ConstantBitrateSeekMap` is based on estimations. |

## Public functions

### getSeekPoints

```
fun getSeekPoints(timeUs: Long): SeekMap.SeekPoints!
```

Obtains seek points for the specified seek time in microseconds. The returned `https://developer.android.com/reference/kotlin/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 |
|---|---|
| `timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | A seek time in microseconds. |

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

### getTimeUsAtPosition

```
fun getTimeUsAtPosition(position: Long): Long
```

Returns the stream time in microseconds for a given position.

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The stream byte-position. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The stream time in microseconds for the given position. |

### isSeekable

```
fun isSeekable(): Boolean
```

Returns whether seeking is supported.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether seeking is supported. |

## Protected functions

### getFirstFramePosition

```
protected fun getFirstFramePosition(): Long
```

Returns the byte position of the first frame in the stream (as passed to the constructor).

### shouldAllowSeeksIfLengthUnknown

```
protected fun shouldAllowSeeksIfLengthUnknown(): Boolean
```

Returns whether seeking is permitted if the stream length is unknown (as passed to the constructor).

## Public properties

### durationUs

```
val durationUs: Long
```

### isEstimated

```
val isEstimated: Boolean
```

## Protected properties

### bitrate

```
protected val bitrate: Int
```

### frameSize

```
protected val frameSize: Int
```