# ChunkIndex

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

*** ** * ** ***

<br />

```
@UnstableApi
class ChunkIndex : SeekMap
```

<br />

*** ** * ** ***

Defines chunks of samples within a media stream.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#ChunkIndex(int[],long[],long[],long[])( sizes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!, offsets: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!, durationsUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!, timesUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>! )` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#getChunkIndex(long)(timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Obtains the index of the chunk corresponding to a given time. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/SeekMap.SeekPoints!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#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/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#isSeekable()()` Returns whether seeking is supported. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#durationUs()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#durationsUs()` The chunk durations, in microseconds. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#length()` The number of chunks. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#offsets()` The chunk byte offsets. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#sizes()` The chunk sizes, in bytes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ChunkIndex#timesUs()` The start time of each chunk, in microseconds. |

### Inherited functions

From [androidx.media3.extractor.SeekMap](https://developer.android.com/reference/kotlin/androidx/media3/extractor/SeekMap) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/extractor/SeekMap#isEstimated()()`

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

## Public constructors

### ChunkIndex

```
ChunkIndex(
    sizes: IntArray<Int>!,
    offsets: LongArray<Long>!,
    durationsUs: LongArray<Long>!,
    timesUs: LongArray<Long>!
)
```

| Parameters |
|---|---|
| `sizes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The chunk sizes, in bytes. |
| `offsets: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!` | The chunk byte offsets. |
| `durationsUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!` | The chunk durations, in microseconds. |
| `timesUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!` | The start time of each chunk, in microseconds. |

## Public functions

### getChunkIndex

```
fun getChunkIndex(timeUs: Long): Int
```

Obtains the index of the chunk corresponding to a given time.

| Parameters |
|---|---|
| `timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time, in microseconds. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the corresponding chunk. |

### 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. |

### 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. |

### toString

```
fun toString(): String!
```

## Public properties

### durationUs

```
val durationUs: Long
```

### durationsUs

```
val durationsUs: Array<Long>!
```

The chunk durations, in microseconds.

### length

```
val length: Int
```

The number of chunks.

### offsets

```
val offsets: Array<Long>!
```

The chunk byte offsets.

### sizes

```
val sizes: Array<Int>!
```

The chunk sizes, in bytes.

### timesUs

```
val timesUs: Array<Long>!
```

The start time of each chunk, in microseconds.