# DefaultDashChunkSource

Artifact: [androidx.media3:media3-exoplayer-dash](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/dash/DefaultDashChunkSource.java+class:androidx.media3.exoplayer.dash.DefaultDashChunkSource)

*** ** * ** ***


```
@UnstableApi
public class DefaultDashChunkSource implements DashChunkSource
```

<br />

*** ** * ** ***

A default `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DashChunkSource` implementation.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource.Factory implements https://developer.android.com/reference/androidx/media3/exoplayer/dash/DashChunkSource.Factory` `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DashChunkSource.Factory` for `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource` instances. |
| `protected final class https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource.RepresentationHolder` Holds information about a snapshot of a single `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Representation`. |
| `protected final class https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource.RepresentationSegmentIterator extends https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/BaseMediaChunkIterator` `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunkIterator` wrapping a `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource.RepresentationHolder`. |

| ### Public fields |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/BaseUrl` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#selectedBaseUrl()` |

| ### Protected fields |
|---|---|
| `final DefaultDashChunkSource.RepresentationHolder[]` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#representationHolders()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#DefaultDashChunkSource(androidx.media3.exoplayer.source.chunk.ChunkExtractor.Factory,androidx.media3.exoplayer.upstream.LoaderErrorThrower,androidx.media3.exoplayer.dash.manifest.DashManifest,androidx.media3.exoplayer.dash.BaseUrlExclusionList,int,int[],androidx.media3.exoplayer.trackselection.ExoTrackSelection,int,androidx.media3.datasource.DataSource,long,int,boolean,java.util.List<androidx.media3.common.Format>,androidx.media3.exoplayer.dash.PlayerEmsgHandler.PlayerTrackEmsgHandler,androidx.media3.exoplayer.analytics.PlayerId,androidx.media3.exoplayer.upstream.CmcdConfiguration,androidx.media3.exoplayer.dash.DashContentSteeringTracker)( https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory chunkExtractorFactory, https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoaderErrorThrower manifestLoaderErrorThrower, https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/DashManifest manifest, https://developer.android.com/reference/androidx/media3/exoplayer/dash/BaseUrlExclusionList baseUrlExclusionList, int periodIndex, int[] adaptationSetIndices, https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/ExoTrackSelection trackSelection, @https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType, https://developer.android.com/reference/androidx/media3/datasource/DataSource dataSource, long elapsedRealtimeOffsetMs, int maxSegmentsPerLoad, boolean enableEventMessageTrack, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Format> closedCaptionFormats, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/PlayerEmsgHandler.PlayerTrackEmsgHandler playerTrackEmsgHandler, https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId playerId, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdConfiguration cmcdConfiguration, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/DashContentSteeringTracker contentSteeringTracker )` |

| ### Public methods |
|---|---|
| `long` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#getAdjustedSeekPositionUs(long,androidx.media3.exoplayer.SeekParameters)( long positionUs, https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters seekParameters )` Adjusts a seek position given the specified `https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters`. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#getNextChunk(androidx.media3.exoplayer.LoadingInfo,long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>,androidx.media3.exoplayer.source.chunk.ChunkHolder)( https://developer.android.com/reference/androidx/media3/exoplayer/LoadingInfo loadingInfo, long loadPositionUs, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk> queue, https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkHolder out )` Returns the next chunk to load. |
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#getPreferredQueueSize(long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)(long playbackPositionUs, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk> queue)` Evaluates whether `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk`s should be removed from the back of the queue. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/BaseUrl` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#getSelectedBaseUrl()()` Returns the selected `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/BaseUrl`. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#maybeThrowError()()` If the source is currently having difficulty providing chunks, then this method throws the underlying error. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#onChunkLoadCompleted(androidx.media3.exoplayer.source.chunk.Chunk)(https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk chunk)` Called when the `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkSampleStream` has finished loading a chunk obtained from this source. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#onChunkLoadError(androidx.media3.exoplayer.source.chunk.Chunk,boolean,androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy.LoadErrorInfo,androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy)( https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk chunk, boolean cancelable, https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo, https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy loadErrorHandlingPolicy )` Called when the `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkSampleStream` encounters an error loading a chunk obtained from this source. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#release()()` Releases any held resources. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#shouldCancelLoad(long,androidx.media3.exoplayer.source.chunk.Chunk,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)( long playbackPositionUs, https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk loadingChunk, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk> queue )` Returns whether an ongoing load of a chunk should be canceled. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#updateManifest(androidx.media3.exoplayer.dash.manifest.DashManifest,int)(https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/DashManifest newManifest, int newPeriodIndex)` Updates the manifest. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#updateTrackSelection(androidx.media3.exoplayer.trackselection.ExoTrackSelection)(https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/ExoTrackSelection trackSelection)` Updates the track selection. |

| ### Protected methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk` | `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/RequiresNonNull.html(value = "#1.chunkExtractor") https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#newInitializationChunk(androidx.media3.exoplayer.dash.DefaultDashChunkSource.RepresentationHolder,androidx.media3.datasource.DataSource,androidx.media3.common.Format,int,java.lang.Object,androidx.media3.exoplayer.dash.manifest.RangedUri,androidx.media3.exoplayer.dash.manifest.RangedUri,androidx.media3.exoplayer.upstream.CmcdData.Factory)( https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource.RepresentationHolder representationHolder, https://developer.android.com/reference/androidx/media3/datasource/DataSource dataSource, https://developer.android.com/reference/androidx/media3/common/Format trackFormat, @https://developer.android.com/reference/androidx/media3/common/C.SelectionReason int trackSelectionReason, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html trackSelectionData, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/RangedUri initializationUri, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/RangedUri indexUri, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory cmcdDataFactory )` Creates a new `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk` for initialization. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource#newMediaChunk(androidx.media3.exoplayer.dash.DefaultDashChunkSource.RepresentationHolder,androidx.media3.datasource.DataSource,int,androidx.media3.common.Format,int,java.lang.Object,long,int,long,long,androidx.media3.exoplayer.upstream.CmcdData.Factory)( https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource.RepresentationHolder representationHolder, https://developer.android.com/reference/androidx/media3/datasource/DataSource dataSource, @https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType, https://developer.android.com/reference/androidx/media3/common/Format trackFormat, @https://developer.android.com/reference/androidx/media3/common/C.SelectionReason int trackSelectionReason, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html trackSelectionData, long firstSegmentNum, int maxSegmentCount, long seekTimeUs, long nowPeriodTimeUs, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory cmcdDataFactory )` |

## Public fields

### selectedBaseUrl

```
public @Nullable BaseUrl selectedBaseUrl
```

## Protected fields

### representationHolders

```
protected final DefaultDashChunkSource.RepresentationHolder[] representationHolders
```

## Public constructors

### DefaultDashChunkSource

```
public DefaultDashChunkSource(
    ChunkExtractor.Factory chunkExtractorFactory,
    LoaderErrorThrower manifestLoaderErrorThrower,
    DashManifest manifest,
    BaseUrlExclusionList baseUrlExclusionList,
    int periodIndex,
    int[] adaptationSetIndices,
    ExoTrackSelection trackSelection,
    @C.TrackType int trackType,
    DataSource dataSource,
    long elapsedRealtimeOffsetMs,
    int maxSegmentsPerLoad,
    boolean enableEventMessageTrack,
    List<Format> closedCaptionFormats,
    @Nullable PlayerEmsgHandler.PlayerTrackEmsgHandler playerTrackEmsgHandler,
    PlayerId playerId,
    @Nullable CmcdConfiguration cmcdConfiguration,
    @Nullable DashContentSteeringTracker contentSteeringTracker
)
```

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor.Factory chunkExtractorFactory` | Creates `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkExtractor` instances to use for extracting chunks. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoaderErrorThrower manifestLoaderErrorThrower` | Throws errors affecting loading of manifests. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/DashManifest manifest` | The initial manifest. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/BaseUrlExclusionList baseUrlExclusionList` | The base URL exclusion list. |
| `int periodIndex` | The index of the period in the manifest. |
| `int[] adaptationSetIndices` | The indices of the adaptation sets in the period. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/ExoTrackSelection trackSelection` | The track selection. |
| `@https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType` | The `https://developer.android.com/reference/androidx/media3/common/C.TrackType` of the tracks in the selection. |
| `https://developer.android.com/reference/androidx/media3/datasource/DataSource dataSource` | A `https://developer.android.com/reference/androidx/media3/datasource/DataSource` suitable for loading the media data. |
| `long elapsedRealtimeOffsetMs` | If known, an estimate of the instantaneous difference between server-side unix time and `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` in milliseconds, specified as the server's unix time minus the local elapsed time. Or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown. |
| `int maxSegmentsPerLoad` | The maximum number of segments to combine into a single request. Note that segments will only be combined if their `https://developer.android.com/reference/android/net/Uri.html`s are the same and if their data ranges are adjacent. |
| `boolean enableEventMessageTrack` | Whether to output an event message track. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Format> closedCaptionFormats` | The `https://developer.android.com/reference/androidx/media3/common/Format` of closed caption tracks to be output. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/PlayerEmsgHandler.PlayerTrackEmsgHandler playerTrackEmsgHandler` | The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/PlayerEmsgHandler.PlayerTrackEmsgHandler` instance to handle emsg messages targeting the player. Maybe null if this is not necessary. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId playerId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` of the player using this chunk source. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdConfiguration cmcdConfiguration` | The `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdConfiguration` for this chunk source. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/DashContentSteeringTracker contentSteeringTracker` | The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DashContentSteeringTracker` to use for Content Steering, or `null` if Content Steering is unavailable. |

## Public methods

### getAdjustedSeekPositionUs

```
public long getAdjustedSeekPositionUs(
    long positionUs,
    SeekParameters seekParameters
)
```

Adjusts a seek position given the specified `https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters`. Chunk boundaries are used as sync points.

| Parameters |
|---|---|
| `long positionUs` | The seek position in microseconds. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters seekParameters` | Parameters that control how the seek is performed. |

| Returns |
|---|---|
| `long` | The adjusted seek position, in microseconds. |

### getNextChunk

```
public void getNextChunk(
    LoadingInfo loadingInfo,
    long loadPositionUs,
    List<MediaChunk> queue,
    ChunkHolder out
)
```

Returns the next chunk to load.

If a chunk is available then `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkHolder#chunk()` is set. If the end of the stream has been reached then `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkHolder#endOfStream()` is set. If a chunk is not available but the end of the stream has not been reached, the `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkHolder` is not modified.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/LoadingInfo loadingInfo` | The `https://developer.android.com/reference/androidx/media3/exoplayer/LoadingInfo` when loading request is made. |
| `long loadPositionUs` | The current load position in microseconds. If `queue` is empty, this is the starting position from which chunks should be provided. Else it's equal to `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk#endTimeUs()` of the last chunk in the `queue`. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk> queue` | The queue of buffered `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk`s. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkHolder out` | A holder to populate. |

### getPreferredQueueSize

```
public int getPreferredQueueSize(long playbackPositionUs, List<MediaChunk> queue)
```

Evaluates whether `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk`s should be removed from the back of the queue.

Removing `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk`s from the back of the queue can be useful if they could be replaced with chunks of a significantly higher quality (e.g. because the available bandwidth has substantially increased).

Will only be called if no `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk` in the queue is currently loading.

| Parameters |
|---|---|
| `long playbackPositionUs` | The current playback position, in microseconds. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk> queue` | The queue of buffered `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk`s. |

| Returns |
|---|---|
| `int` | The preferred queue size. |

### getSelectedBaseUrl

```
public @Nullable BaseUrl getSelectedBaseUrl()
```

Returns the selected `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/BaseUrl`.

The default implementation returns `null`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/BaseUrl` | The selected `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/BaseUrl` of this `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DashChunkSource`. Can be `null` if unknown or if no `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/BaseUrl` has been selected. |

### maybeThrowError

```
public void maybeThrowError()
```

If the source is currently having difficulty providing chunks, then this method throws the underlying error. Otherwise does nothing.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | The underlying error. |

### onChunkLoadCompleted

```
public void onChunkLoadCompleted(Chunk chunk)
```

Called when the `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkSampleStream` has finished loading a chunk obtained from this source.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk chunk` | The chunk whose load has been completed. |

### onChunkLoadError

```
public boolean onChunkLoadError(
    Chunk chunk,
    boolean cancelable,
    LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)
```

Called when the `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkSampleStream` encounters an error loading a chunk obtained from this source.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk chunk` | The chunk whose load encountered the error. |
| `boolean cancelable` | Whether the load can be canceled. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy.LoadErrorInfo loadErrorInfo` | The load error info. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy loadErrorHandlingPolicy` | The load error handling policy to customize the behaviour of handling the load error. |

| Returns |
|---|---|
| `boolean` | Whether the load should be canceled so that a replacement chunk can be loaded instead. Must be `false` if `cancelable` is `false`. If `true`, `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/ChunkSource#getNextChunk(androidx.media3.exoplayer.LoadingInfo,long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>,androidx.media3.exoplayer.source.chunk.ChunkHolder)` will be called to obtain the replacement chunk. |

### release

```
public void release()
```

Releases any held resources.

### shouldCancelLoad

```
public boolean shouldCancelLoad(
    long playbackPositionUs,
    Chunk loadingChunk,
    List<MediaChunk> queue
)
```

Returns whether an ongoing load of a chunk should be canceled.

| Parameters |
|---|---|
| `long playbackPositionUs` | The current playback position, in microseconds. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk loadingChunk` | The currently loading `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk`. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk> queue` | The queue of buffered `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/MediaChunk`. |

| Returns |
|---|---|
| `boolean` | Whether the ongoing load of `loadingChunk` should be canceled. |

### updateManifest

```
public void updateManifest(DashManifest newManifest, int newPeriodIndex)
```

Updates the manifest.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/DashManifest newManifest` | The new manifest. |
| `int newPeriodIndex` | The index of the period covered by `newManifest`. |

### updateTrackSelection

```
public void updateTrackSelection(ExoTrackSelection trackSelection)
```

Updates the track selection.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/ExoTrackSelection trackSelection` | The new track selection instance. Must be equivalent to the previous one. |

## Protected methods

### newInitializationChunk

```
@RequiresNonNull(value = "#1.chunkExtractor")
protected Chunk newInitializationChunk(
    DefaultDashChunkSource.RepresentationHolder representationHolder,
    DataSource dataSource,
    Format trackFormat,
    @C.SelectionReason int trackSelectionReason,
    @Nullable Object trackSelectionData,
    @Nullable RangedUri initializationUri,
    @Nullable RangedUri indexUri,
    @Nullable CmcdData.Factory cmcdDataFactory
)
```

Creates a new `https://developer.android.com/reference/androidx/media3/exoplayer/source/chunk/Chunk` for initialization.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/DefaultDashChunkSource.RepresentationHolder representationHolder` | The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Representation` holder for initialization. |
| `https://developer.android.com/reference/androidx/media3/datasource/DataSource dataSource` | The source from which the data should be loaded. |
| `https://developer.android.com/reference/androidx/media3/common/Format trackFormat` | The format of the track to which this chunk belongs. |
| `@https://developer.android.com/reference/androidx/media3/common/C.SelectionReason int trackSelectionReason` | One of the `https://developer.android.com/reference/androidx/media3/common/C.SelectionReason`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html trackSelectionData` | Additional data related to track selection. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/RangedUri initializationUri` | The URI pointing to initialization data. Can be `null` if ` indexUri` is not `null`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/RangedUri indexUri` | The URI pointing to index data. Can be `null` if ` initializationUri` is not `null`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory cmcdDataFactory` | The `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory` for generating `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData`. |

### newMediaChunk

```
protected Chunk newMediaChunk(
    DefaultDashChunkSource.RepresentationHolder representationHolder,
    DataSource dataSource,
    @C.TrackType int trackType,
    Format trackFormat,
    @C.SelectionReason int trackSelectionReason,
    @Nullable Object trackSelectionData,
    long firstSegmentNum,
    int maxSegmentCount,
    long seekTimeUs,
    long nowPeriodTimeUs,
    @Nullable CmcdData.Factory cmcdDataFactory
)
```