Package 

Class MediaDownloadable


  • 
    public abstract class MediaDownloadable
    
                        

    An abstract class that holds information related to a remote media (Video) to be downloaded and responsible to manage the download of its components such as video, audio and text.

    • Method Detail

      • getEstimatedSize

         long getEstimatedSize()

        Returns the estimated total size of the media, which includes all assets such video, audioand subtitles. Please note the method should be called after calling requestDownload

        The actual size of the media that will be used by the host device may vary based on thepartition type and format of the storage.

      • registerDownloadable

         static void registerDownloadable(@NonNull() DeliveryType deliveryType, @NonNull() Class<out MediaDownloadable> downloadableClass)

        Registers the downloadable class that must be used to handled download of the specifiedmedia delivery type.

        Parameters:
        deliveryType - the deliverty type
        downloadableClass - the media downloadable class.
      • setVideoBitrate

         void setVideoBitrate(int videoBitrate)

        Sets the video bitrate cap which will be used to determine what rendition will be downloaded.If there's no rendition lower than the video bitrate provided, the next higher will be picked.

        Parameters:
        videoBitrate - the video bitrate
      • estimatedSize

         void estimatedSize(MediaDownloadable.OnVideoSizeCallback callback)

        Returns the estimated total size of the media, which includes all assets such video, audioand subtitles.

        The actual size of the media that will be used by the host device may vary based on thepartition type and format of the storage.This method requires the Media Manifest to estimate the size, thereforeit might download the manifest and store it to the directory provided in the ( object in the constructor, if it has not been done already.

        Parameters:
        callback - the approximate size of the media.
      • requestDownload

         boolean requestDownload()

        Requests the media to be downloaded asynchronously.

      • pauseDownload

         int pauseDownload()

        Attempts to pause download of this media.

      • resumeDownload

         int resumeDownload()

        Attempts to resume download of this media.

      • cancelDownload

         boolean cancelDownload()

        Cancels download of the media if it has not been completed yet. If the media has beendownloaded already, then calling this method will have no effect.Please call deleteDownload method instead to delete the media.

      • deleteDownload

         boolean deleteDownload()

        Deletes the offline copy of the media. If the media has not been fully downloadedyet, then it will be removed from the download queue and any partially download assetsbelonging to the media will be deleted.

      • getDownloadStatus

         DownloadStatus getDownloadStatus()

        Checks the overall download status by inspecting the status of each request in the entiredownload set. Please note that this is a blocking call. Checking the status of large mediawith multiple assets may take time.