CmcdData.Factory


public final class CmcdData.Factory


CmcdData.Factory for CmcdData instances.

Summary

Constants

static final String

Represents the object type for audio-only content in a media container.

static final String

Represents the object type for an initialization segment in a media container.

static final String

Represents the object type for muxed audio and video content in a media container.

static final String

Represents the object type for video-only content in a media container.

static final String

Represents the Dynamic Adaptive Streaming over HTTP (DASH) format.

static final String

Represents the HTTP Live Streaming (HLS) format.

static final String

Represents the Smooth Streaming (SS) format.

static final String

Represents the Live Streaming stream type.

static final String

Represents the Video on Demand (VOD) stream type.

Public constructors

Factory(
    CmcdConfiguration cmcdConfiguration,
    ExoTrackSelection trackSelection,
    long bufferedDurationUs,
    float playbackRate,
    @CmcdData.StreamingFormat @CmcdData.StreamingFormat String streamingFormat,
    boolean isLive,
    boolean didRebuffer,
    boolean isBufferEmpty
)

Creates an instance.

Public methods

CmcdData
static @Nullable @CmcdData.ObjectType String

Retrieves the object type value from the given ExoTrackSelection.

CmcdData.Factory

Sets the duration of current media chunk being requested, in microseconds.

CmcdData.Factory

Sets the relative path of the next object to be requested.

CmcdData.Factory

Sets the byte range representing the partial object request.

CmcdData.Factory

Sets the object type of the current object being requested.

Constants

OBJECT_TYPE_AUDIO_ONLY

public static final String OBJECT_TYPE_AUDIO_ONLY = "a"

Represents the object type for audio-only content in a media container.

OBJECT_TYPE_INIT_SEGMENT

public static final String OBJECT_TYPE_INIT_SEGMENT = "i"

Represents the object type for an initialization segment in a media container.

OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO

public static final String OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO = "av"

Represents the object type for muxed audio and video content in a media container.

OBJECT_TYPE_VIDEO_ONLY

public static final String OBJECT_TYPE_VIDEO_ONLY = "v"

Represents the object type for video-only content in a media container.

STREAMING_FORMAT_DASH

public static final String STREAMING_FORMAT_DASH = "d"

Represents the Dynamic Adaptive Streaming over HTTP (DASH) format.

STREAMING_FORMAT_HLS

public static final String STREAMING_FORMAT_HLS = "h"

Represents the HTTP Live Streaming (HLS) format.

STREAMING_FORMAT_SS

public static final String STREAMING_FORMAT_SS = "s"

Represents the Smooth Streaming (SS) format.

STREAM_TYPE_LIVE

public static final String STREAM_TYPE_LIVE = "l"

Represents the Live Streaming stream type.

STREAM_TYPE_VOD

public static final String STREAM_TYPE_VOD = "v"

Represents the Video on Demand (VOD) stream type.

Public constructors

Factory

public Factory(
    CmcdConfiguration cmcdConfiguration,
    ExoTrackSelection trackSelection,
    long bufferedDurationUs,
    float playbackRate,
    @CmcdData.StreamingFormat @CmcdData.StreamingFormat String streamingFormat,
    boolean isLive,
    boolean didRebuffer,
    boolean isBufferEmpty
)

Creates an instance.

Parameters
CmcdConfiguration cmcdConfiguration

The CmcdConfiguration for this chunk source.

ExoTrackSelection trackSelection

The track selection.

long bufferedDurationUs

The duration of media currently buffered from the current playback position, in microseconds.

float playbackRate

The playback rate indicating the current speed of playback.

@CmcdData.StreamingFormat @CmcdData.StreamingFormat String streamingFormat

The streaming format of the media content. Must be one of the allowed streaming formats specified by the CmcdData.StreamingFormat annotation.

boolean isLive

true if the media content is being streamed live, false otherwise.

boolean didRebuffer

true if a rebuffering event happened between the previous request and this one, false otherwise.

boolean isBufferEmpty

true if the queue of buffered chunks is empty, false otherwise.

Throws
java.lang.IllegalArgumentException

If bufferedDurationUs is negative or playbackRate is non-positive.

Public methods

createCmcdData

public CmcdData createCmcdData()

getObjectType

@CmcdData.ObjectType
public static @Nullable @CmcdData.ObjectType String getObjectType(ExoTrackSelection trackSelection)

Retrieves the object type value from the given ExoTrackSelection.

Parameters
ExoTrackSelection trackSelection

The ExoTrackSelection from which to retrieve the object type.

Returns
@Nullable @CmcdData.ObjectType String

The object type value as a String if TrackType can be mapped to one of the object types specified by CmcdData.ObjectType annotation, or null.

Throws
java.lang.IllegalArgumentException

if the provided ExoTrackSelection is null.

setChunkDurationUs

@CanIgnoreReturnValue
public CmcdData.Factory setChunkDurationUs(long chunkDurationUs)

Sets the duration of current media chunk being requested, in microseconds. The default value is TIME_UNSET.

Throws
java.lang.IllegalArgumentException

If chunkDurationUs is negative.

setNextObjectRequest

@CanIgnoreReturnValue
public CmcdData.Factory setNextObjectRequest(@Nullable String nextObjectRequest)

Sets the relative path of the next object to be requested. This can be used to trigger pre-fetching by the CDN.

Default is null.

setNextRangeRequest

@CanIgnoreReturnValue
public CmcdData.Factory setNextRangeRequest(@Nullable String nextRangeRequest)

Sets the byte range representing the partial object request. This can be used to trigger pre-fetching by the CDN.

Default is null.

setObjectType

@CanIgnoreReturnValue
public CmcdData.Factory setObjectType(
    @CmcdData.ObjectType @Nullable @CmcdData.ObjectType String objectType
)

Sets the object type of the current object being requested. Must be one of the allowed object types specified by the CmcdData.ObjectType annotation.

Default is null.