HlsMultivariantPlaylist


@UnstableApi
public final class HlsMultivariantPlaylist extends HlsPlaylist


Represents an HLS multivariant playlist.

Summary

Nested types

A rendition (i.e. an #EXT-X-MEDIA tag) in a multivariant playlist.

A variant (i.e. an #EXT-X-STREAM-INF tag) in a multivariant playlist.

Constants

static final HlsMultivariantPlaylist

Represents an empty multivariant playlist, from which no attributes can be inherited.

static final int
static final int
static final int

Public fields

final List<HlsMultivariantPlaylist.Rendition>

The audio renditions declared by the playlist.

final List<HlsMultivariantPlaylist.Rendition>

The closed caption renditions declared by the playlist.

final List<Uri>

All of the media playlist URLs referenced by the playlist.

final @Nullable Format

The format of the audio muxed in the variants.

final @Nullable List<Format>

The format of the closed captions declared by the playlist.

final List<DrmInitData>

DRM initialization data derived from #EXT-X-SESSION-KEY tags.

final List<HlsMultivariantPlaylist.Rendition>

The subtitle renditions declared by the playlist.

final Map<StringString>

Contains variable definitions, as defined by the #EXT-X-DEFINE tag.

final List<HlsMultivariantPlaylist.Variant>

The variants declared by the playlist.

final List<HlsMultivariantPlaylist.Rendition>

The video renditions declared by the playlist.

Public constructors

HlsMultivariantPlaylist(
    String baseUri,
    List<String> tags,
    List<HlsMultivariantPlaylist.Variant> variants,
    List<HlsMultivariantPlaylist.Rendition> videos,
    List<HlsMultivariantPlaylist.Rendition> audios,
    List<HlsMultivariantPlaylist.Rendition> subtitles,
    List<HlsMultivariantPlaylist.Rendition> closedCaptions,
    @Nullable Format muxedAudioFormat,
    @Nullable List<Format> muxedCaptionFormats,
    boolean hasIndependentSegments,
    Map<StringString> variableDefinitions,
    List<DrmInitData> sessionKeyDrmInitData
)

Public methods

HlsMultivariantPlaylist
copy(List<StreamKey> streamKeys)

Returns a copy of the manifest including only the streams specified by the given keys.

static HlsMultivariantPlaylist

Creates a playlist with a single variant.

Inherited fields

From androidx.media3.exoplayer.hls.playlist.HlsPlaylist
final String

The base uri.

final boolean

Whether the media is formed of independent segments, as defined by the #EXT-X-INDEPENDENT-SEGMENTS tag.

final List<String>

The list of tags in the playlist.

Constants

EMPTY

public static final HlsMultivariantPlaylist EMPTY

Represents an empty multivariant playlist, from which no attributes can be inherited.

GROUP_INDEX_AUDIO

public static final int GROUP_INDEX_AUDIO = 1

GROUP_INDEX_SUBTITLE

public static final int GROUP_INDEX_SUBTITLE = 2

GROUP_INDEX_VARIANT

public static final int GROUP_INDEX_VARIANT = 0

Public fields

audios

public final List<HlsMultivariantPlaylist.Renditionaudios

The audio renditions declared by the playlist.

closedCaptions

public final List<HlsMultivariantPlaylist.RenditionclosedCaptions

The closed caption renditions declared by the playlist.

mediaPlaylistUrls

public final List<UrimediaPlaylistUrls

All of the media playlist URLs referenced by the playlist.

muxedAudioFormat

public final @Nullable Format muxedAudioFormat

The format of the audio muxed in the variants. May be null if the playlist does not declare any muxed audio.

muxedCaptionFormats

public final @Nullable List<FormatmuxedCaptionFormats

The format of the closed captions declared by the playlist. May be empty if the playlist explicitly declares no captions are available, or null if the playlist does not declare any captions information.

sessionKeyDrmInitData

public final List<DrmInitDatasessionKeyDrmInitData

DRM initialization data derived from #EXT-X-SESSION-KEY tags.

subtitles

public final List<HlsMultivariantPlaylist.Renditionsubtitles

The subtitle renditions declared by the playlist.

variableDefinitions

public final Map<StringStringvariableDefinitions

Contains variable definitions, as defined by the #EXT-X-DEFINE tag.

variants

public final List<HlsMultivariantPlaylist.Variantvariants

The variants declared by the playlist.

videos

public final List<HlsMultivariantPlaylist.Renditionvideos

The video renditions declared by the playlist.

Public constructors

HlsMultivariantPlaylist

public HlsMultivariantPlaylist(
    String baseUri,
    List<String> tags,
    List<HlsMultivariantPlaylist.Variant> variants,
    List<HlsMultivariantPlaylist.Rendition> videos,
    List<HlsMultivariantPlaylist.Rendition> audios,
    List<HlsMultivariantPlaylist.Rendition> subtitles,
    List<HlsMultivariantPlaylist.Rendition> closedCaptions,
    @Nullable Format muxedAudioFormat,
    @Nullable List<Format> muxedCaptionFormats,
    boolean hasIndependentSegments,
    Map<StringString> variableDefinitions,
    List<DrmInitData> sessionKeyDrmInitData
)
Parameters
String baseUri

See baseUri.

List<String> tags

See tags.

List<HlsMultivariantPlaylist.Variant> variants

See variants.

List<HlsMultivariantPlaylist.Rendition> videos

See videos.

List<HlsMultivariantPlaylist.Rendition> audios

See audios.

List<HlsMultivariantPlaylist.Rendition> subtitles

See subtitles.

List<HlsMultivariantPlaylist.Rendition> closedCaptions

See closedCaptions.

@Nullable Format muxedAudioFormat

See muxedAudioFormat.

@Nullable List<Format> muxedCaptionFormats

See muxedCaptionFormats.

boolean hasIndependentSegments

See hasIndependentSegments.

Map<StringString> variableDefinitions

See variableDefinitions.

List<DrmInitData> sessionKeyDrmInitData

See sessionKeyDrmInitData.

Public methods

copy

public HlsMultivariantPlaylist copy(List<StreamKey> streamKeys)

Returns a copy of the manifest including only the streams specified by the given keys. If the manifest is unchanged then the instance may return itself.

Parameters
List<StreamKey> streamKeys

A non-empty list of stream keys.

Returns
HlsMultivariantPlaylist

The filtered manifest.

createSingleVariantMultivariantPlaylist

public static HlsMultivariantPlaylist createSingleVariantMultivariantPlaylist(String variantUrl)

Creates a playlist with a single variant.

Parameters
String variantUrl

The url of the single variant.

Returns
HlsMultivariantPlaylist

A multivariant playlist with a single variant for the provided url.