# SingleSampleMediaChunk

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/source/chunk/SingleSampleMediaChunk.java+class:androidx.media3.exoplayer.source.chunk.SingleSampleMediaChunk)

*** ** * ** ***


```
@UnstableApi
class SingleSampleMediaChunk : BaseMediaChunk
```

<br />

|---|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||||
| ↳ | [androidx.media3.exoplayer.source.chunk.Chunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk) ||||
|   | ↳ | [androidx.media3.exoplayer.source.chunk.MediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk) |||
|   |   | ↳ | [androidx.media3.exoplayer.source.chunk.BaseMediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk) ||
|   |   |   | ↳ | [androidx.media3.exoplayer.source.chunk.SingleSampleMediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk) |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> The only use for this class is subtitle playback, but it is only compatible with legacy subtitle decoding, which is not supported by default. Users of this class almost certainly need to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/text/TextRenderer#experimentalSetLegacyDecodingEnabled(boolean)` on their `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer` instance in order to avoid playback errors when trying to play subtitles.

## Summary

| ### Public constructors |
|---|
| `[SingleSampleMediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#SingleSampleMediaChunk(androidx.media3.datasource.DataSource,androidx.media3.datasource.DataSpec,androidx.media3.common.Format,int,java.lang.Object,long,long,long,int,androidx.media3.common.Format))( dataSource: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource!, dataSpec: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSpec!, trackFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.SelectionReason trackSelectionReason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, trackSelectionData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, startTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, endTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, chunkIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType trackType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sampleFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format! )` **This function is deprecated.** Deprecated in Java |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[cancelLoad](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#cancelLoad())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[isLoadCompleted](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#isLoadCompleted())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[load](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#load())()` **This function is deprecated.** Deprecated in Java |

### Inherited functions

From [androidx.media3.exoplayer.source.chunk.BaseMediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `[getFirstSampleIndex](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#getFirstSampleIndex(int))(trackIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[init](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#init(androidx.media3.exoplayer.source.chunk.BaseMediaChunkOutput))(output: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunkOutput!)`

**This function is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.Chunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `[bytesLoaded](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#bytesLoaded())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `[getDurationUs](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#getDurationUs())()`

**This function is deprecated.** Deprecated in Java
`(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!>!` `[getResponseHeaders](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#getResponseHeaders())()`

**This function is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/net/Uri.html!` `[getUri](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#getUri())()`

**This function is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.MediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `[getNextChunkIndex](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk#getNextChunkIndex())()`

**This function is deprecated.** Deprecated in Java

### Inherited properties

From [androidx.media3.exoplayer.source.chunk.BaseMediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#clippedEndTimeUs()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#clippedStartTimeUs()`

**This property is deprecated.** Deprecated in Java
`@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/MonotonicNonNull.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunkOutput!` `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/MonotonicNonNull.html
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/BaseMediaChunk#output()`

**This property is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.Chunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk) `https://developer.android.com/reference/kotlin/androidx/media3/datasource/StatsDataSource!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#dataSource()`

**This property is deprecated.** Deprecated in Java
`https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSpec!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#dataSpec()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#endTimeUs()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#loadTaskId()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#startTimeUs()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#steeredPathwayId()`

**This property is deprecated.** Deprecated in Java
`https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#trackFormat()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionData()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.SelectionReason
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionReason()`

**This property is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.DataType
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#type()`

**This property is deprecated.** Deprecated in Java
From [androidx.media3.exoplayer.source.chunk.MediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk#chunkIndex()`

**This property is deprecated.** Deprecated in Java

## Public constructors

### SingleSampleMediaChunk

```
[SingleSampleMediaChunk](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#SingleSampleMediaChunk(androidx.media3.datasource.DataSource,androidx.media3.datasource.DataSpec,androidx.media3.common.Format,int,java.lang.Object,long,long,long,int,androidx.media3.common.Format))(
    dataSource: DataSource!,
    dataSpec: DataSpec!,
    trackFormat: Format!,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    startTimeUs: Long,
    endTimeUs: Long,
    chunkIndex: Long,
    @C.TrackType trackType: Int,
    sampleFormat: Format!
)
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

| Parameters |
|---|---|
| `dataSource: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource!` | The source from which the data should be loaded. |
| `dataSpec: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSpec!` | Defines the data to be loaded. |
| `trackFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | See `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#trackFormat()`. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.SelectionReason trackSelectionReason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | See `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionReason()`. |
| `trackSelectionData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | See `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk#trackSelectionData()`. |
| `startTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The start time of the media contained by the chunk, in microseconds. |
| `endTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The end time of the media contained by the chunk, in microseconds. |
| `chunkIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The index of the chunk, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if it is not known. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType trackType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType` of the chunk. |
| `sampleFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of the sample in the chunk. |

## Public functions

### cancelLoad

```
fun [cancelLoad](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#cancelLoad())(): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Cancels the load.

Loadable implementations should ensure that a currently executing `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` call will exit reasonably quickly after this method is called. The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` call may exit either by returning or by throwing an `https://developer.android.com/reference/java/io/IOException.html`.

If there is a currently executing `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` call, then the thread on which that call is being made will be interrupted immediately after the call to this method. Hence implementations do not need to (and should not attempt to) interrupt the loading thread themselves.

Although the loading thread will be interrupted, Loadable implementations should not use the interrupted status of the loading thread in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Loader.Loadable#load()` to determine whether the load has been canceled. This approach is not robust \[Internal ref: b/79223737\]. Instead, implementations should use their own flag to signal cancelation (for example, using `https://developer.android.com/reference/java/util/concurrent/atomic/AtomicBoolean.html`).

### isLoadCompleted

```
fun [isLoadCompleted](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#isLoadCompleted())(): Boolean
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Returns whether the chunk has been fully loaded.

### load

```
fun [load](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/SingleSampleMediaChunk#load())(): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Performs the load, returning on completion or cancellation.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If the input could not be loaded. |