DownloadRequest


@UnstableApi
public final class DownloadRequest implements Parcelable


Defines content to be downloaded.

Summary

Nested types

A builder for download requests.

Thrown when the encoded request data belongs to an unsupported request type.

Constants

static final Parcelable.Creator<DownloadRequest>

Public fields

final @Nullable String

Custom key for cache indexing, or null.

final byte[]

Application defined data associated with the download.

final String

The unique content id.

final @Nullable byte[]

The key set id of the offline licence if the content is protected with DRM.

final @Nullable String

The MIME type of this content.

final List<StreamKey>

Stream keys to be downloaded.

final Uri

The uri being downloaded.

Public methods

DownloadRequest

Returns a copy with the specified ID.

DownloadRequest
copyWithKeySetId(@Nullable byte[] keySetId)

Returns a copy with the specified key set ID.

DownloadRequest

Returns the result of merging newRequest into this request.

int
boolean
final int
MediaItem

Returns a MediaItem for the content defined by the request.

String
void
writeToParcel(Parcel dest, int flags)

Inherited Constants

From android.os.Parcelable
static final int
static final int

Constants

CREATOR

public static final Parcelable.Creator<DownloadRequestCREATOR

Public fields

customCacheKey

public final @Nullable String customCacheKey

Custom key for cache indexing, or null. Must be null for DASH, HLS and SmoothStreaming downloads.

data

public final byte[] data

Application defined data associated with the download. May be empty.

id

public final String id

The unique content id.

keySetId

public final @Nullable byte[] keySetId

The key set id of the offline licence if the content is protected with DRM.

mimeType

public final @Nullable String mimeType

The MIME type of this content. Used as a hint to infer the content's type (DASH, HLS, SmoothStreaming). If null, a DownloadService will infer the content type from the uri.

streamKeys

public final List<StreamKeystreamKeys

Stream keys to be downloaded. If empty, all streams will be downloaded.

uri

public final Uri uri

The uri being downloaded.

Public methods

copyWithId

public DownloadRequest copyWithId(String id)

Returns a copy with the specified ID.

Parameters
String id

The ID of the copy.

Returns
DownloadRequest

The copy with the specified ID.

copyWithKeySetId

public DownloadRequest copyWithKeySetId(@Nullable byte[] keySetId)

Returns a copy with the specified key set ID.

Parameters
@Nullable byte[] keySetId

The key set ID of the copy.

Returns
DownloadRequest

The copy with the specified key set ID.

copyWithMergedRequest

public DownloadRequest copyWithMergedRequest(DownloadRequest newRequest)

Returns the result of merging newRequest into this request. The requests must have the same id.

The resulting request contains the stream keys from both requests. For all other member variables, those in newRequest are preferred.

Parameters
DownloadRequest newRequest

The request being merged.

Returns
DownloadRequest

The merged result.

Throws
java.lang.IllegalArgumentException

If the requests do not have the same id.

describeContents

public int describeContents()

equals

public boolean equals(@Nullable Object o)

hashCode

public final int hashCode()

toMediaItem

public MediaItem toMediaItem()

Returns a MediaItem for the content defined by the request.

toString

public String toString()

writeToParcel

public void writeToParcel(Parcel dest, int flags)