Class Download
- All Implemented Interfaces:
- Serializable
- See Also:
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe download is completedstatic final intAt least one chunk download failed and the download is in error statestatic final intThe download is pausedstatic final intThe download is currently downloadingstatic final intThe download is queued for loading
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanGet all available (remote) audio tracks or null if no audio tracks are available.longReturns the size in bytes of the currently download data on disk.Returns the content DRM configuration.longReturns the total size of all selected tracks of this download.Returns a Bundle with the extra header key:values that will be added to the requests.getId()Returns the unique ID that identifies this download.The local folder that contains the files for this download.Returns the path to the local Manifest.booleanThe flag specifying the video tracks should be merged or notReturns a Bundle with the extra query params that will be added to the requests.Returns the remote URL that is the primary source for this download.int[]Get the array of selected audio tracks by indexint[]Get the array of selected subtitle tracks by indexintGet the index of the selected trick-play trackintGet the index of the selected video tracklonggetSize(int mediaType, int trackIndex) Returns the size of the chunk with the given media type, i.eSdkConsts.VIDEO,SdkConsts.AUDIO,SdkConsts.TEXT, orSdkConsts.OTHER, and its track index.longgetSize(int mediaType, int trackIndex, boolean isTrickPlay) Returns the size of the chunk with the given media type, i.eSdkConsts.VIDEO,SdkConsts.AUDIO,SdkConsts.TEXT, orSdkConsts.OTHER, and its track index.intgetState()Get the current state of this downloadcom.castlabs.sdk.downloader.TrackDownload[]Returns the subtitle track downloads for this download.Get all available (remote) subtitle tracks or null if no subtitle tracks are available.All available (remote) trick-play representations.All available (remote) video representations.inthashCode()voidsetHeaderParams(Bundle headers) Sets the headers to add to the download requests.voidsetQueryParams(Bundle queryParams) Sets the query params to add to the download requests.voidsetSelectedAudioTracks(int[] selectedAudioTracks) Set the array of selected audio tracksvoidsetSelectedSubtitleTracks(int[] selectedSubtitleTracks) Set the selected subtitle tracks by indexvoidsetSelectedTrickPlayTrackQuality(int selectedTrickPlayTrackQuality) Set the selected trick-play track quality using its index in the list of available representations.voidsetSelectedVideoTrackQuality(int selectedVideoTrackQuality) Set the selected video track quality using its index in the list of available representations.toString()
- 
Field Details- 
STATE_QUEUEDpublic static final int STATE_QUEUEDThe download is queued for loading- See Also:
 
- 
STATE_LOADINGpublic static final int STATE_LOADINGThe download is currently downloading- See Also:
 
- 
STATE_ERRORpublic static final int STATE_ERRORAt least one chunk download failed and the download is in error state- See Also:
 
- 
STATE_DONEpublic static final int STATE_DONEThe download is completed- See Also:
 
- 
STATE_IDLEpublic static final int STATE_IDLEThe download is paused- See Also:
 
 
- 
- 
Constructor Details- 
Downloadpublic Download(@NonNull String id, @NonNull String remoteUrl, @NonNull File localBaseFolder, boolean mergeVideoTracks) Create Download with specified Id, manifest URL and base folder for storage.- Parameters:
- id- Current download Id
- remoteUrl- Manifest remote URL
- localBaseFolder- Base folder for storing current download
- mergeVideoTracks- Whether to merge video tracks or not
 
 
- 
- 
Method Details- 
getIdReturns the unique ID that identifies this download.- Returns:
- The unique ID that identifies this download
 
- 
getRemoteUrlReturns the remote URL that is the primary source for this download.- Returns:
- The remote URL that us the primary source for this download
 
- 
getLocalBaseFolderThe local folder that contains the files for this download. Each download usually has a unique folder that contains all files related to this download.- Returns:
- The local folder that contains the files for this download
 
- 
getMergeVideoTrackspublic boolean getMergeVideoTracks()The flag specifying the video tracks should be merged or not- Returns:
- The merge video tracks flag
 
- 
getVideoTrackQualitiesAll available (remote) video representations. This represents all video qualities that are available on the remote, not only the locally available representations.- Returns:
- All available video representations
 
- 
getTrickPlayTrackQualitiesAll available (remote) trick-play representations. This represents all trick-play qualities that are available on the remote, not only the locally available representations.- Returns:
- All available trick-play representations
 
- 
getDownloadedSizepublic long getDownloadedSize()Returns the size in bytes of the currently download data on disk.- Returns:
- Currently downloaded data
 
- 
getAudioTracksGet all available (remote) audio tracks or null if no audio tracks are available. This represents all audio tracks that are available on the remote, not only the locally available tracks.- Returns:
- The available (remote) audio tracks
 
- 
getSubtitleTracksGet all available (remote) subtitle tracks or null if no subtitle tracks are available. This represents all subtitle tracks that are available on the remote, not only the locally available tracks.- Returns:
- The available (remote) subtitle tracks
 
- 
getSelectedVideoTrackQualitypublic int getSelectedVideoTrackQuality()Get the index of the selected video track- Returns:
- The index of the selected video track.
 
- 
setSelectedVideoTrackQualitypublic void setSelectedVideoTrackQuality(int selectedVideoTrackQuality) Set the selected video track quality using its index in the list of available representations.- Parameters:
- selectedVideoTrackQuality- The video track quality index
 
- 
getSelectedTrickPlayTrackQualitypublic int getSelectedTrickPlayTrackQuality()Get the index of the selected trick-play track- Returns:
- The index of the selected trick-play track.
 
- 
setSelectedTrickPlayTrackQualitypublic void setSelectedTrickPlayTrackQuality(int selectedTrickPlayTrackQuality) Set the selected trick-play track quality using its index in the list of available representations.- Parameters:
- selectedTrickPlayTrackQuality- The trick-play track quality index
 
- 
getSelectedAudioTracks@Nullable public int[] getSelectedAudioTracks()Get the array of selected audio tracks by index- Returns:
- The array of selected audio tracks by index
 
- 
setSelectedAudioTrackspublic void setSelectedAudioTracks(@Nullable int[] selectedAudioTracks) Set the array of selected audio tracks- Parameters:
- selectedAudioTracks- The selected audio tracks
 
- 
getSelectedSubtitleTracks@Nullable public int[] getSelectedSubtitleTracks()Get the array of selected subtitle tracks by index- Returns:
- The array of selected subtitle tracks by index
 
- 
setSelectedSubtitleTrackspublic void setSelectedSubtitleTracks(@Nullable int[] selectedSubtitleTracks) Set the selected subtitle tracks by index- Parameters:
- selectedSubtitleTracks- The selected subtitle tracks by index
 
- 
getLocalManifestUrlReturns the path to the local Manifest. Once the download is completed, this path can be used to start playback of the local content.- Returns:
- The path to the local manifest
 
- 
getDrmConfigurationReturns the content DRM configuration.- Returns:
- Content DRM configuration
 
- 
getStatepublic int getState()Get the current state of this download- Returns:
- The current state of this download
 
- 
getEstimatedSizepublic long getEstimatedSize()Returns the total size of all selected tracks of this download.Note that the manifest size only will be returned when no tracks are selected. Please also note that the number of bytes returned here is an estimate of the total size of the download. Depending on the download source, i.e. file, DASH, or SmoothStreaming, information from the source is used to create this estimate. For example, for SmoothStreaming content, a track size is estimated based on the bitrate and the duration of the track. The same is true for segmented DASH. If a DASH source is based on single files, we try to use the information from the manifest that is used to generate the range requests to estimate the size. The latter is more accurate than simply using the specified bitrate, but it is still an estimate. - Returns:
- The estimated size in bytes of this download
 
- 
getSizepublic long getSize(int mediaType, int trackIndex) Returns the size of the chunk with the given media type, i.eSdkConsts.VIDEO,SdkConsts.AUDIO,SdkConsts.TEXT, orSdkConsts.OTHER, and its track index.- Parameters:
- mediaType- The media type
- trackIndex- The track index
- Returns:
- The size in bytes or 0
 
- 
getSizepublic long getSize(int mediaType, int trackIndex, boolean isTrickPlay) Returns the size of the chunk with the given media type, i.eSdkConsts.VIDEO,SdkConsts.AUDIO,SdkConsts.TEXT, orSdkConsts.OTHER, and its track index.- Parameters:
- mediaType- The media type
- trackIndex- The track index
- isTrickPlay- Whether the track is trick-play or not
- Returns:
- The size in bytes or 0
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
getSubtitleTrackDownloadspublic com.castlabs.sdk.downloader.TrackDownload[] getSubtitleTrackDownloads()Returns the subtitle track downloads for this download.- Returns:
- the subtitle track downloads for this download.
 
- 
getHeaderParamsReturns a Bundle with the extra header key:values that will be added to the requests.This Bundle will contain the headers informed with the SdkConsts.INTENT_HEADER_PARAMS_BUNDLEkey in the Bundle passed toDownloadServiceBinder.prepareDownload(Context, Bundle, Downloader.ModelReadyCallback).- Returns:
- a Bundle with the extra header key:values that will be added to the requests.
 
- 
setHeaderParamsSets the headers to add to the download requests.If null, all already existing headers will be cleared. - Parameters:
- headers- a Bundle containing headers to add to the download requests
 
- 
getQueryParamsReturns a Bundle with the extra query params that will be added to the requests.This Bundle will contain the query params informed with the SdkConsts.INTENT_QUERY_PARAMS_BUNDLEkey in the Bundle passed toDownloadServiceBinder.prepareDownload(Context, Bundle, Downloader.ModelReadyCallback).- Returns:
- a Bundle with the extra query params that will be added to the requests.
 
- 
setQueryParamsSets the query params to add to the download requests.If null, all already existing query params will be cleared. - Parameters:
- queryParams- a Bundle containing query params to add to the download requests
 
 
-