DownloadRequest
@UnstableApi
public final class DownloadRequest implements Parcelable
Defines content to be downloaded.
Summary
Nested types |
|---|
public class DownloadRequest.BuilderA builder for download requests. |
public final class DownloadRequest.ByteRange implements ParcelableDefines the byte range. |
public final class DownloadRequest.TimeRange implements ParcelableDefines the time range. |
public class DownloadRequest.UnsupportedRequestException extends IOExceptionThrown when the encoded request data belongs to an unsupported request type. |
Constants |
|
|---|---|
static final Parcelable.Creator<DownloadRequest> |
Public fields |
|
|---|---|
final @Nullable DownloadRequest.ByteRange |
The byte range to be downloaded. |
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 @Nullable DownloadRequest.TimeRange |
The time range to be downloaded. |
final Uri |
The uri being downloaded. |
Public methods |
|
|---|---|
DownloadRequest |
copyWithId(String id)Returns a copy with the specified ID. |
DownloadRequest |
copyWithKeySetId(@Nullable byte[] keySetId)Returns a copy with the specified key set ID. |
DownloadRequest |
copyWithMergedRequest(DownloadRequest newRequest)Returns the result of merging |
int |
|
boolean |
|
int |
hashCode() |
MediaItem |
Returns a |
MediaItem |
toMediaItem(MediaItem.Builder builder)Propagates the content information defined by the request to the |
String |
toString() |
void |
writeToParcel(Parcel dest, int flags) |
Inherited Constants |
||||
|---|---|---|---|---|
|
Constants
Public fields
byteRange
public final @Nullable DownloadRequest.ByteRange byteRange
The byte range to be downloaded. Must be null for DASH, HLS and SmoothStreaming downloads.
customCacheKey
public final @Nullable String customCacheKey
Custom key for cache indexing, or null. Must be null for DASH, HLS and SmoothStreaming downloads.
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<StreamKey> streamKeys
Stream keys to be downloaded. If empty, all streams will be downloaded.
timeRange
public final @Nullable DownloadRequest.TimeRange timeRange
The time range to be downloaded. Must be null progressive downloads.
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 |
toMediaItem
public MediaItem toMediaItem()
Returns a MediaItem for the content defined by the request.
toMediaItem
public MediaItem toMediaItem(MediaItem.Builder builder)
Propagates the content information defined by the request to the MediaItem.Builder and returns a MediaItem.
| Parameters | |
|---|---|
MediaItem.Builder builder |
The |