@UnstableApi
class DashUtil


Utility methods for DASH streams.

Summary

Public functions

java-static DataSpec!
buildDataSpec(
    representation: Representation!,
    requestUri: RangedUri!,
    flags: Int
)

This function is deprecated.

Use buildDataSpec instead.

java-static DataSpec!
buildDataSpec(
    representation: Representation!,
    baseUrl: String!,
    requestUri: RangedUri!,
    flags: Int
)

This function is deprecated.

Use buildDataSpec instead.

java-static DataSpec!
buildDataSpec(
    representation: Representation!,
    baseUrl: String!,
    requestUri: RangedUri!,
    flags: Int,
    httpRequestHeaders: (Mutable)Map<String!, String!>!
)

Builds a DataSpec for a given RangedUri belonging to Representation.

java-static ChunkIndex?
loadChunkIndex(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!
)

Loads initialization and index data for the representation and returns the .

java-static ChunkIndex?
loadChunkIndex(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!,
    baseUrlIndex: Int
)

Loads initialization and index data for the representation and returns the .

java-static Format?
loadFormatWithDrmInitData(dataSource: DataSource!, period: Period!)

Loads a Format for acquiring keys for a given period in a DASH manifest.

java-static Unit
loadInitializationData(
    chunkExtractor: ChunkExtractor!,
    dataSource: DataSource!,
    representation: Representation!,
    loadIndex: Boolean
)

Loads initialization data for the representation and optionally index data then returns a BundledChunkExtractor which contains the output.

java-static DashManifest!
loadManifest(dataSource: DataSource!, uri: Uri!)

Loads a DASH manifest.

java-static Format?
loadSampleFormat(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!
)

Loads initialization data for the representation and returns the sample Format.

java-static Format?
loadSampleFormat(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!,
    baseUrlIndex: Int
)

Loads initialization data for the representation and returns the sample Format.

java-static String!
resolveCacheKey(representation: Representation!, rangedUri: RangedUri!)

Resolves the cache key to be used when requesting the given ranged URI for the given .

Public functions

buildDataSpec

java-static fun buildDataSpec(
    representation: Representation!,
    requestUri: RangedUri!,
    flags: Int
): DataSpec!

buildDataSpec

java-static fun buildDataSpec(
    representation: Representation!,
    baseUrl: String!,
    requestUri: RangedUri!,
    flags: Int
): DataSpec!

buildDataSpec

java-static fun buildDataSpec(
    representation: Representation!,
    baseUrl: String!,
    requestUri: RangedUri!,
    flags: Int,
    httpRequestHeaders: (Mutable)Map<String!, String!>!
): DataSpec!

Builds a DataSpec for a given RangedUri belonging to Representation.

Parameters
representation: Representation!

The Representation to which the request belongs.

baseUrl: String!

The base url with which to resolve the request URI.

requestUri: RangedUri!

The RangedUri of the data to request.

flags: Int

Flags to be set on the returned DataSpec. See setFlags.

httpRequestHeaders: (Mutable)Map<String!, String!>!

The httpRequestHeaders.

Returns
DataSpec!

The DataSpec.

loadChunkIndex

java-static fun loadChunkIndex(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!
): ChunkIndex?

Loads initialization and index data for the representation and returns the .

Uses the first base URL for loading the index.

Parameters
dataSource: DataSource!

The source from which the data should be loaded.

trackType: Int

The type of the representation. Typically one of the androidx.media3.common.CTRACK_TYPE_* constants.

representation: Representation!

The representation which initialization chunk belongs to.

Returns
ChunkIndex?

The ChunkIndex of the given representation, or null if no initialization or index data exists.

Throws
java.io.IOException

Thrown when there is an error while loading.

loadChunkIndex

java-static fun loadChunkIndex(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!,
    baseUrlIndex: Int
): ChunkIndex?

Loads initialization and index data for the representation and returns the .

Parameters
dataSource: DataSource!

The source from which the data should be loaded.

trackType: Int

The type of the representation. Typically one of the androidx.media3.common.CTRACK_TYPE_* constants.

representation: Representation!

The representation which initialization chunk belongs to.

baseUrlIndex: Int

The index of the base URL with which to resolve the request URI.

Returns
ChunkIndex?

The ChunkIndex of the given representation, or null if no initialization or index data exists.

Throws
java.io.IOException

Thrown when there is an error while loading.

loadFormatWithDrmInitData

java-static fun loadFormatWithDrmInitData(dataSource: DataSource!, period: Period!): Format?

Loads a Format for acquiring keys for a given period in a DASH manifest.

Parameters
dataSource: DataSource!

The DataSource from which data should be loaded.

period: Period!

The Period.

Returns
Format?

The loaded Format, or null if none is defined.

Throws
java.io.IOException

Thrown when there is an error while loading.

loadInitializationData

java-static fun loadInitializationData(
    chunkExtractor: ChunkExtractor!,
    dataSource: DataSource!,
    representation: Representation!,
    loadIndex: Boolean
): Unit

Loads initialization data for the representation and optionally index data then returns a BundledChunkExtractor which contains the output.

Uses the first base URL for loading the initialization data.

Parameters
chunkExtractor: ChunkExtractor!

The ChunkExtractor to use.

dataSource: DataSource!

The source from which the data should be loaded.

representation: Representation!

The representation which initialization chunk belongs to.

loadIndex: Boolean

Whether to load index data too.

Throws
java.io.IOException

Thrown when there is an error while loading.

loadManifest

java-static fun loadManifest(dataSource: DataSource!, uri: Uri!): DashManifest!

Loads a DASH manifest.

Parameters
dataSource: DataSource!

The DataSource from which the manifest should be read.

uri: Uri!

The Uri of the manifest to be read.

Returns
DashManifest!

An instance of DashManifest.

Throws
java.io.IOException

Thrown when there is an error while loading.

loadSampleFormat

java-static fun loadSampleFormat(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!
): Format?

Loads initialization data for the representation and returns the sample Format.

Uses the first base URL for loading the format.

Parameters
dataSource: DataSource!

The source from which the data should be loaded.

trackType: Int

The type of the representation. Typically one of the androidx.media3.common.CTRACK_TYPE_* constants.

representation: Representation!

The representation which initialization chunk belongs to.

Returns
Format?

the sample Format of the given representation.

Throws
java.io.IOException

Thrown when there is an error while loading.

loadSampleFormat

java-static fun loadSampleFormat(
    dataSource: DataSource!,
    trackType: Int,
    representation: Representation!,
    baseUrlIndex: Int
): Format?

Loads initialization data for the representation and returns the sample Format.

Parameters
dataSource: DataSource!

The source from which the data should be loaded.

trackType: Int

The type of the representation. Typically one of the androidx.media3.common.CTRACK_TYPE_* constants.

representation: Representation!

The representation which initialization chunk belongs to.

baseUrlIndex: Int

The index of the base URL to be picked from the list of base URLs.

Returns
Format?

the sample Format of the given representation.

Throws
java.io.IOException

Thrown when there is an error while loading.

resolveCacheKey

java-static fun resolveCacheKey(representation: Representation!, rangedUri: RangedUri!): String!

Resolves the cache key to be used when requesting the given ranged URI for the given .

Parameters
representation: Representation!

The Representation to which the URI belongs to.

rangedUri: RangedUri!

The URI for which to resolve the cache key.

Returns
String!

The cache key.