public class DashDownloadable extends MediaDownloadable implements com.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
MediaDownloadable
responsible to manage the download of a Dash Video and its assets.MediaDownloadable.DownloadEventListener, MediaDownloadable.MediaFormatListener, MediaDownloadable.OnVideoSizeCallback
AUDIO_LANGUAGE_ROLES, AUDIO_LANGUAGES, CAPTIONS, configurationBundle, context, DEFAULT_MPD_NAME, downloadEventListener, downloadManager, estimatedSize, requestConfig, video, VIDEO_RENDITIONS
Constructor and Description |
---|
DashDownloadable(android.content.Context context,
Video video,
MediaDownloadable.DownloadEventListener downloadEventListener,
RequestConfig requestConfig) |
Modifier and Type | Method and Description |
---|---|
void |
estimatedSize(MediaDownloadable.OnVideoSizeCallback callback)
Returns the estimated total size of the media, which includes all assets such video, audio
and subtitles.
|
void |
getMediaFormatTracksAvailable(MediaDownloadable.MediaFormatListener mediaFormatListener)
An asynchronous call to retrieve the MediaFormat tracks available for the current video.
|
protected java.util.HashMap<java.lang.String,java.io.Serializable> |
getMediaProperties() |
void |
onLoadCanceled(MediaPresentationDescriptionLoadable loadable,
long elapsedRealtimeMs,
long loadDurationMs,
boolean released) |
void |
onLoadCompleted(MediaPresentationDescriptionLoadable loadable,
long elapsedRealtimeMs,
long loadDurationMs) |
com.google.android.exoplayer2.upstream.Loader.LoadErrorAction |
onLoadError(MediaPresentationDescriptionLoadable loadable,
long elapsedRealtimeMs,
long loadDurationMs,
java.io.IOException error,
int errorCount) |
protected void |
onMediaDownloadComplete(DownloadStatus status)
Called when the media download has completed successfully.
|
boolean |
requestDownload()
Requests the media to be downloaded asynchronously.
|
cancelDownload, create, create, createDownloadRequest, deleteDownload, enqueueDownloadRequest, getConfigurationBundle, getDownloadDirectory, getDownloadStatus, getEstimatedSize, onMediaDownloadCancelled, onMediaDownloadDeleted, onMediaDownloadFailed, onMediaDownloadPaused, onMediaDownloadProgress, onMediaDownloadRequested, onMediaDownloadStarted, pauseDownload, registerDownloadable, resumeDownload, setConfigurationBundle, setVideoBitrate
public DashDownloadable(@NonNull android.content.Context context, @NonNull Video video, @Nullable MediaDownloadable.DownloadEventListener downloadEventListener, @Nullable RequestConfig requestConfig)
public void getMediaFormatTracksAvailable(@NonNull MediaDownloadable.MediaFormatListener mediaFormatListener)
MediaDownloadable
MediaDownloadable.MediaFormatListener
listener.
Note: Only the video type DeliveryType.DASH
is currently supported.
getMediaFormatTracksAvailable
in class MediaDownloadable
mediaFormatListener
- the media format listenerpublic boolean requestDownload()
MediaDownloadable
requestDownload
in class MediaDownloadable
MediaDownloadable.downloadEventListener
.
Please use MediaDownloadable.getDownloadStatus()
to query the download status.public void estimatedSize(MediaDownloadable.OnVideoSizeCallback callback)
MediaDownloadable
The actual size of the media that will be used by the host device may vary based on the
partition type and format of the storage.
This method requires the Media Manifest to estimate the size, therefore
it might download the manifest and store it to the directory provided in the
RequestConfig()
object in the constructor, if it has not been done already.
estimatedSize
in class MediaDownloadable
callback
- the approximate size of the media.public void onLoadCompleted(MediaPresentationDescriptionLoadable loadable, long elapsedRealtimeMs, long loadDurationMs)
onLoadCompleted
in interface com.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
public void onLoadCanceled(MediaPresentationDescriptionLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released)
onLoadCanceled
in interface com.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
public com.google.android.exoplayer2.upstream.Loader.LoadErrorAction onLoadError(MediaPresentationDescriptionLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, java.io.IOException error, int errorCount)
onLoadError
in interface com.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
protected void onMediaDownloadComplete(@NonNull DownloadStatus status)
MediaDownloadable
onMediaDownloadComplete
in class MediaDownloadable
@NonNull protected java.util.HashMap<java.lang.String,java.io.Serializable> getMediaProperties()
getMediaProperties
in class MediaDownloadable