DownloadRequest.Builder


public class DownloadRequest.Builder


A builder for download requests.

Summary

Public constructors

Builder(String id, Uri uri)

Creates a new instance with the specified id and uri.

Public constructors

Builder

public Builder(String id, Uri uri)

Creates a new instance with the specified id and uri.

Public methods

build

public DownloadRequest build()

setByteRange

@CanIgnoreReturnValue
public DownloadRequest.Builder setByteRange(long offset, long length)

Sets the byte range to be downloaded.

This will be ignored for DASH, HLS and SmoothStreaming downloads.

Parameters
long offset

The offset that the download should start from.

long length

The length from the offset to be downloaded, or @link C#LENGTH_UNSET} if the media should be downloaded to the end.

setCustomCacheKey

@CanIgnoreReturnValue
public DownloadRequest.Builder setCustomCacheKey(@Nullable String customCacheKey)

Sets the customCacheKey.

setData

@CanIgnoreReturnValue
public DownloadRequest.Builder setData(@Nullable byte[] data)

Sets the data.

setKeySetId

@CanIgnoreReturnValue
public DownloadRequest.Builder setKeySetId(@Nullable byte[] keySetId)

Sets the keySetId.

setTimeRange

@CanIgnoreReturnValue
public DownloadRequest.Builder setTimeRange(long startPositionUs, long durationUs)

Sets the time range to be downloaded.

This will be ignored progressive downloads.

Parameters
long startPositionUs

The start position in microseconds that the download should start from.

long durationUs

The duration in microseconds from the startPositionUs to be downloaded, or TIME_UNSET if the media should be downloaded to the end.