Interface IDownloadManager

  • All Known Implementing Classes:
    DownloadManager

    public interface IDownloadManager
    Defines the contract of a download manager, which can used to queue and manage download requests.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  IDownloadManager.IRequest
      Contract of a download request that can be submitted to the download manager.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      io.reactivex.Observable<com.brightcove.player.store.DownloadRequestSet> createDownloadRequestSet​(RequestConfig requestConfig, long estimatedSize, DownloadManager.Listener listener)
      Creates an empty download request set with the specified estimated size.
      boolean deleteDownload​(com.brightcove.player.store.DownloadRequestSet requestSet)
      Cancels all the download requests in the specified set and removes the download request set.
      boolean deleteDownload​(java.lang.Long requestSetKey)
      Cancels all the download requests in the specified set and removes the download request set.
      io.reactivex.Observable<com.brightcove.player.store.DownloadRequestSet> enqueueDownload​(com.brightcove.player.store.DownloadRequestSet requestSet, IDownloadManager.IRequest... requests)
      Enqueues a set of download requests to the specified request set.
      DownloadStatus getDownloadStatus​(com.brightcove.player.store.DownloadRequestSet requestSet)
      Queries the overall download status of the specified download request set.
      DownloadStatus getDownloadStatus​(java.lang.Long requestSetKey)
      Queries the overall download status of the specified download request set.
      DownloadStatus pauseDownload​(com.brightcove.player.store.DownloadRequestSet requestSet)
      Pauses download of the specified request set, if it is not already paused.
      DownloadStatus pauseDownload​(java.lang.Long requestSetKey)
      Pauses download of the specified request set, if it is not already paused.
      DownloadStatus resumeDownload​(com.brightcove.player.store.DownloadRequestSet requestSet)
      Resumes download of the specified request set, if it is currently paused.
      DownloadStatus resumeDownload​(java.lang.Long requestSetKey)
      Resumes download of the specified request set, if it is currently paused.
    • Method Detail

      • createDownloadRequestSet

        @NonNull
        io.reactivex.Observable<com.brightcove.player.store.DownloadRequestSet> createDownloadRequestSet​(@Nullable
                                                                                                         RequestConfig requestConfig,
                                                                                                         long estimatedSize,
                                                                                                         @NonNull
                                                                                                         DownloadManager.Listener listener)
        Creates an empty download request set with the specified estimated size.

        Please note the operation will be carried on a background i/o thread.

        Parameters:
        requestConfig - the configuration to be used for handling the download requests.
        estimatedSize - the estimated total size of the download.
        listener - reference to the callback listener that must be notified about status changes related to this download request.
        Returns:
        reference to an Observable that must subscribed to complete operation and obtain the result.
      • enqueueDownload

        @NonNull
        io.reactivex.Observable<com.brightcove.player.store.DownloadRequestSet> enqueueDownload​(@NonNull
                                                                                                com.brightcove.player.store.DownloadRequestSet requestSet,
                                                                                                @NonNull
                                                                                                IDownloadManager.IRequest... requests)
        Enqueues a set of download requests to the specified request set. The status of the download request set will be more to DownloadStatus.STATUS_PENDING immediately adding the requests to the database. The DownloadManager will start to process the download requests after this call, because of network availability and current download queue load.

        Please note the operation will be carried on a background i/o thread.

        Parameters:
        requestSet - reference to the
        requests - the download requests to be enqueued.
        Returns:
        reference to an Observable that must subscribed to complete operation and obtain the result.
      • pauseDownload

        @NonNull
        DownloadStatus pauseDownload​(@Nullable
                                     com.brightcove.player.store.DownloadRequestSet requestSet)
        Pauses download of the specified request set, if it is not already paused.
        Parameters:
        requestSet - reference to the download request to be paused.
        Returns:
        the new status of download request set.
      • pauseDownload

        @NonNull
        DownloadStatus pauseDownload​(@NonNull
                                     java.lang.Long requestSetKey)
        Pauses download of the specified request set, if it is not already paused.
        Parameters:
        requestSetKey - the unique identifier to the download request.
        Returns:
        the new status of download request set.
      • resumeDownload

        @NonNull
        DownloadStatus resumeDownload​(@Nullable
                                      com.brightcove.player.store.DownloadRequestSet requestSet)
        Resumes download of the specified request set, if it is currently paused.
        Parameters:
        requestSet - reference to the download request to be resumed.
        Returns:
        the new status of download request set.
      • resumeDownload

        @NonNull
        DownloadStatus resumeDownload​(@NonNull
                                      java.lang.Long requestSetKey)
        Resumes download of the specified request set, if it is currently paused.
        Parameters:
        requestSetKey - the unique identifier to the download request.
        Returns:
        the new status of download request set.
      • deleteDownload

        boolean deleteDownload​(@Nullable
                               com.brightcove.player.store.DownloadRequestSet requestSet)
        Cancels all the download requests in the specified set and removes the download request set.
        Parameters:
        requestSet - the request set to be cancelled.
        Returns:
        true if the request set was found and removed, otherwise false.
      • deleteDownload

        boolean deleteDownload​(@NonNull
                               java.lang.Long requestSetKey)
        Cancels all the download requests in the specified set and removes the download request set.
        Parameters:
        requestSetKey - the unique identifier to the download request.
        Returns:
        true if the request set was found and removed, otherwise false.
      • getDownloadStatus

        @NonNull
        DownloadStatus getDownloadStatus​(@NonNull
                                         java.lang.Long requestSetKey)
        Queries the overall download status of the specified download request set.
        Parameters:
        requestSetKey - the unique identifier to the download request.
        Returns:
        the overall download status
      • getDownloadStatus

        @NonNull
        DownloadStatus getDownloadStatus​(@Nullable
                                         com.brightcove.player.store.DownloadRequestSet requestSet)
        Queries the overall download status of the specified download request set.
        Parameters:
        requestSet - reference to the download request set.
        Returns:
        the overall download status