Package com.google.android.exoplayer2.source.chunk

## Class MediaChunk

- java.lang.Object
- - com.google.android.exoplayer2.source.chunk.Chunk
  - - com.google.android.exoplayer2.source.chunk.MediaChunk

- All Implemented Interfaces:
    `Loader.Loadable`
  Direct Known Subclasses:
    `BaseMediaChunk`, `FakeMediaChunk`

      public abstract class MediaChunk
      extends Chunk

  An abstract base class for `Chunk`s that contain media samples.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `long` | `chunkIndex` | The chunk index, or `C.INDEX_UNSET` if it is not known.

    - ### Fields inherited from class com.google.android.exoplayer2.source.chunk.Chunk

      `dataSource, dataSpec, endTimeUs, loadTaskId, startTimeUs, trackFormat, trackSelectionData, trackSelectionReason, type`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MediaChunk​(DataSource dataSource, DataSpec dataSpec, Format trackFormat, @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason, Object trackSelectionData, long startTimeUs, long endTimeUs, long chunkIndex)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `long` | `getNextChunkIndex()` | Returns the next chunk index or `C.INDEX_UNSET` if it is not known.
    `abstract boolean` | `isLoadCompleted()` | Returns whether the chunk has been fully loaded.

    - ### Methods inherited from class com.google.android.exoplayer2.source.chunk.Chunk

      `bytesLoaded, getDurationUs, getResponseHeaders, getUri`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.google.android.exoplayer2.upstream.Loader.Loadable

      `cancelLoad, load`

- - ### Field Detail

    - #### chunkIndex

          public final long chunkIndex

      The chunk index, or `C.INDEX_UNSET` if it is not known.

  - ### Constructor Detail

    - #### MediaChunk

          public MediaChunk​(DataSource dataSource,
                            DataSpec dataSpec,
                            Format trackFormat,
                            @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason,
                            @Nullable
                            Object trackSelectionData,
                            long startTimeUs,
                            long endTimeUs,
                            long chunkIndex)

      Parameters:
        `dataSource` - The source from which the data should be loaded.
        `dataSpec` - Defines the data to be loaded.
        `trackFormat` - See `Chunk.trackFormat`.
        `trackSelectionReason` - See `Chunk.trackSelectionReason`.
        `trackSelectionData` - See `Chunk.trackSelectionData`.
        `startTimeUs` - The start time of the media contained by the chunk, in microseconds.
        `endTimeUs` - The end time of the media contained by the chunk, in microseconds.
        `chunkIndex` - The index of the chunk, or `C.INDEX_UNSET` if it is not known.

  - ### Method Detail

    - #### getNextChunkIndex

          public long getNextChunkIndex()

      Returns the next chunk index or `C.INDEX_UNSET` if it is not known.

    - #### isLoadCompleted

          public abstract boolean isLoadCompleted()

      Returns whether the chunk has been fully loaded.