Package com.brightcove.player.offline
Class DashDownloadable
java.lang.Object
com.brightcove.player.offline.MediaDownloadable
com.brightcove.player.offline.DashDownloadable
- All Implemented Interfaces:
com.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
public class DashDownloadable
extends MediaDownloadable
implements com.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
A
MediaDownloadable
responsible to manage the download of a Dash Video and its assets.-
Nested Class Summary
Nested classes/interfaces inherited from class com.brightcove.player.offline.MediaDownloadable
MediaDownloadable.DownloadEventListener, MediaDownloadable.MediaFormatListener, MediaDownloadable.OnVideoSizeCallback
-
Field Summary
Fields inherited from class com.brightcove.player.offline.MediaDownloadable
AUDIO_LANGUAGE_ROLES, AUDIO_LANGUAGES, CAPTIONS, configurationBundle, context, DEFAULT_MPD_NAME, downloadEventListener, downloadManager, estimatedSize, requestConfig, video, VIDEO_RENDITIONS
-
Constructor Summary
ConstructorDescriptionDashDownloadable
(android.content.Context context, Video video, MediaDownloadable.DownloadEventListener downloadEventListener, RequestConfig requestConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 HashMap<String,
Serializable> 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, IOException error, int errorCount) protected void
Called when the media download has completed successfully.boolean
Requests the media to be downloaded asynchronously.Methods inherited from class com.brightcove.player.offline.MediaDownloadable
cancelDownload, create, create, createDownloadRequest, deleteDownload, enqueueDownloadRequest, getConfigurationBundle, getDownloadDirectory, getDownloadStatus, getEstimatedSize, getMediaUrl, onMediaDownloadCancelled, onMediaDownloadDeleted, onMediaDownloadFailed, onMediaDownloadPaused, onMediaDownloadProgress, onMediaDownloadRequested, onMediaDownloadStarted, pauseDownload, registerDownloadable, resumeDownload, setConfigurationBundle, setVideoBitrate
-
Constructor Details
-
DashDownloadable
public DashDownloadable(@NonNull android.content.Context context, @NonNull Video video, @Nullable MediaDownloadable.DownloadEventListener downloadEventListener, @Nullable RequestConfig requestConfig)
-
-
Method Details
-
getMediaFormatTracksAvailable
public void getMediaFormatTracksAvailable(@NonNull MediaDownloadable.MediaFormatListener mediaFormatListener) Description copied from class:MediaDownloadable
An asynchronous call to retrieve the MediaFormat tracks available for the current video. The result will be given through theMediaDownloadable.MediaFormatListener
listener.Note: Only the video type
DeliveryType.DASH
is currently supported.- Specified by:
getMediaFormatTracksAvailable
in classMediaDownloadable
- Parameters:
mediaFormatListener
- the media format listener
-
requestDownload
public boolean requestDownload()Description copied from class:MediaDownloadable
Requests the media to be downloaded asynchronously.- Overrides:
requestDownload
in classMediaDownloadable
- Returns:
- true if the request was successfully placed in the download queue, otherwise false.
Please note that a true value does not mean that media has been downloaded successfully.
The actual status of the download request will be published to the
MediaDownloadable.downloadEventListener
. Please useMediaDownloadable.getDownloadStatus()
to query the download status.
-
estimatedSize
Description copied from class:MediaDownloadable
Returns the estimated total size of the media, which includes all assets such video, audio and subtitles.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.- Overrides:
estimatedSize
in classMediaDownloadable
- Parameters:
callback
- the approximate size of the media.
-
onLoadCompleted
public void onLoadCompleted(MediaPresentationDescriptionLoadable loadable, long elapsedRealtimeMs, long loadDurationMs) - Specified by:
onLoadCompleted
in interfacecom.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
-
onLoadCanceled
public void onLoadCanceled(MediaPresentationDescriptionLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released) - Specified by:
onLoadCanceled
in interfacecom.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
-
onLoadError
public com.google.android.exoplayer2.upstream.Loader.LoadErrorAction onLoadError(MediaPresentationDescriptionLoadable loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) - Specified by:
onLoadError
in interfacecom.google.android.exoplayer2.upstream.Loader.Callback<MediaPresentationDescriptionLoadable>
-
onMediaDownloadComplete
Description copied from class:MediaDownloadable
Called when the media download has completed successfully.- Overrides:
onMediaDownloadComplete
in classMediaDownloadable
-
getMediaProperties
- Specified by:
getMediaProperties
in classMediaDownloadable
-