com.brightcove.player.offline

## Class Mp4Downloadable

- java.lang.Object
- - com.brightcove.player.offline.MediaDownloadable
  - - com.brightcove.player.offline.Mp4Downloadable

-     public class Mp4Downloadable
      extends MediaDownloadable

  A `MediaDownloadable` responsible to manage the download of a MP4 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

    Constructors
    Constructor and Description
    `Mp4Downloadable(android.content.Context context, Video video, MediaDownloadable.DownloadEventListener downloadEventListener, RequestConfig requestConfig)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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()`
    `protected void` | `onMediaDownloadComplete(DownloadStatus status)` Called when the media download has completed successfully.
    `boolean` | `requestDownload()` 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, onMediaDownloadCancelled, onMediaDownloadDeleted, onMediaDownloadFailed, onMediaDownloadPaused, onMediaDownloadProgress, onMediaDownloadRequested, onMediaDownloadStarted, pauseDownload, registerDownloadable, resumeDownload, setConfigurationBundle, setVideoBitrate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Mp4Downloadable

          public Mp4Downloadable(@NonNull
                                 android.content.Context context,
                                 @NonNull
                                 Video video,
                                 @Nullable
                                 MediaDownloadable.DownloadEventListener downloadEventListener,
                                 @Nullable
                                 RequestConfig requestConfig)

  - ### Method Detail

    - #### 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 the `MediaDownloadable.MediaFormatListener` listener.

      Note: Only the video type `DeliveryType.DASH` is currently supported.

      Specified by:
        `getMediaFormatTracksAvailable` in class `MediaDownloadable`
      Parameters:
        `mediaFormatListener` - the media format listener

    - #### requestDownload

          public boolean requestDownload()

      Requests the media to be downloaded asynchronously. The actual status of the download request will be published to the `MediaDownloadable.downloadEventListener`. Please use `MediaDownloadable.getDownloadStatus()` to query the download status.
      Overrides:
        `requestDownload` in class `MediaDownloadable`
      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 use `MediaDownloadable.getDownloadStatus()` to query the download status.
      Throws:
        `java.lang.IllegalStateException` - If the video has been already queued for download.

    - #### estimatedSize

          public void estimatedSize(MediaDownloadable.OnVideoSizeCallback callback)

      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 class `MediaDownloadable`
      Parameters:
        `callback` - the approximate size of the media.

    - #### onMediaDownloadComplete

          protected void onMediaDownloadComplete(@NonNull
                                                 DownloadStatus status)

      Description copied from class: `MediaDownloadable`
      Called when the media download has completed successfully.
      Overrides:
        `onMediaDownloadComplete` in class `MediaDownloadable`

    - #### getMediaProperties

          @NonNull
          protected java.util.HashMap<java.lang.String,java.io.Serializable> getMediaProperties()

      Specified by:
        `getMediaProperties` in class `MediaDownloadable`