Package 

Class OfflineStoreManager

  • All Implemented Interfaces:
    com.brightcove.player.store.MediaStore

    
    public class OfflineStoreManager
    extends BaseStore
                        

    Store manager can be used to persist data into an application specific private database.

    • Method Detail

      • refreshEntity

        @Nullable() <E extends IdentifiableEntity> E refreshEntity(@Nullable() E entity)

        Refresh the given entity. This refreshes the already loaded properties in the entity.If no properties are loaded then the default properties will be loaded.

        Parameters:
        entity - reference to the entity to be refreshed.
      • saveEntity

         <T extends IdentifiableEntity> T saveEntity(@NonNull() T entity)

        Inserts or updates the given entity.

        Parameters:
        entity - the entity to be save.
      • updateDownloadRequestIdList

        @Nullable() OfflineVideo updateDownloadRequestIdList(@NonNull() String videoId, @Nullable() List<Long> requestIdList, long estimatedSize)

        Updates the entity with given unique video identifier to save the current list of downloadrequest identifiers.

        Parameters:
        videoId - the unique video identifier.
        requestIdList - a list of download request identifiers.
      • saveOfflineVideo

         OfflineVideo saveOfflineVideo(@NonNull() Video video, @NonNull() File downloadDirectory, @NonNull() DownloadRequestSet requestSet)

        Saves the offline video information into the store.

        Parameters:
        video - the video information to be saved.
        downloadDirectory - the download directory for this video.
        requestSet - the download request set related to this video.
      • saveOfflineVideo

        @NonNull() OfflineVideo saveOfflineVideo(Video video)

        Updates the entity with given unique video identifier to save the video metadata object,while retaining the previously saved license information.

        Parameters:
        video - the video to be saved.
      • saveOfflineLicense

        @NonNull() OfflineVideo saveOfflineLicense(@NonNull() Video video)

        Updates the entity with given unique video identifier to save the video license information.

        Parameters:
        video - the video to be saved.
      • findOfflineVideo

        @Nullable() OfflineVideo findOfflineVideo(@NonNull() String videoId)

        Finds the first offline video entity with the given video identifier.

        Parameters:
        videoId - the unique video identifier.
      • deleteOfflineVideo

         boolean deleteOfflineVideo(@NonNull() String videoId)

        Deletes the first offline video entity with the given video identifier.

        Parameters:
        videoId - the unique video identifier.
      • findDownloadRequestSets

         Collection<DownloadRequestSet> findDownloadRequestSets(@NonNull() Array<Long> requestIds)

        Finds the download request sets to which the given requests belong to.

        Parameters:
        requestIds - an array of one or more download requests.
      • deleteDownloadRequestSet

         boolean deleteDownloadRequestSet(@NonNull() Long key)

        Deletes the specified request set from the store.

        Parameters:
        key - the primary key of the request set to be deleted.
      • updateDownloadRequestStatusByDownloadId

        @Nullable() DownloadRequest updateDownloadRequestStatusByDownloadId(@NonNull() Long downloadId, int statusCode, int reasonCode, long bytesDownloaded, long actualSize, boolean updateParentRecord)

        Updates the status of download request.

        Parameters:
        downloadId - the unique identifier of the download request that caused the status change.
        statusCode - the new status of the download.
        reasonCode - the reason code for the new status, if any.
        bytesDownloaded - the number of bytes downloaded so far.
        actualSize - the total size of the download.
        updateParentRecord - true to update the DownloadRequestSet parent record.
      • updateDownloadRequestSetStatus

         boolean updateDownloadRequestSetStatus(DownloadRequestSet requestSet, int statusCode, int reasonCode, DownloadRequest downloadRequest, boolean evaluateAllSegments)

        Updates the status of Download Request Set.

        Parameters:
        requestSet - the Download Request Set
        statusCode - the new status of the download segment.
        reasonCode - the reason code for the new status, if any.
        downloadRequest - the new segment Download Request
        evaluateAllSegments - if true, it makes sure to evaluate all download request segments to get the overall status.
      • resumeDownloadRequestSet

        @Nullable() DownloadRequestSet resumeDownloadRequestSet(@NonNull() Long key)

        Marks a download request set as waiting to be queued.

        Parameters:
        key - the primary key of the request set to be paused.
      • updateDownloadId

         boolean updateDownloadId(@NonNull() Long key, Long downloadId)

        Sets the download identifier for the request with the specified primary key.

        Parameters:
        key - the primary key of the request to be updated.
        downloadId - the unique identifier to the download request in the android.app.DownloadManager
      • changeDownloadIdentifier

        @Nullable() OfflineVideo changeDownloadIdentifier(@NonNull() Video video)

        Changes the download identifier associated with given video. This method is intended forinternal use only. Please do not call this in the application project.

        Parameters:
        video - reference to the video.
      • markRequestSetForRemoval

        @NonNull() List<DownloadRequest> markRequestSetForRemoval(@NonNull() Long key)

        Marks the specified request set for removal. A request set that has been marked for removalwill not be queued or checked for further status changes. Any download requests in the setthat has been queued already will be removed. The request set itself will be deleted once allthe requests have been removed.

        Parameters:
        key - the primary key of the request set to be updated.
      • findDownloadsToBeQueued

        @NonNull() List<DownloadRequest> findDownloadsToBeQueued(int batchSize, boolean excludeWifiOnly)

        Fetches a list of download requests that not have been queued for download by the android.app.DownloadManager.

        Parameters:
        batchSize - the maximum number of entities to fetch.
        excludeWifiOnly - true if the requests that allowed only on wifi networks must be excluded, otherwise false.
      • countDownloadRequestsInState

         int countDownloadRequestsInState(@NonNull() Long requestSetKey, int statusCode)

        Counts the download requests belonging to a DownloadRequestSet with the specified status code.

        Parameters:
        requestSetKey - the Download Request Set key.
        statusCode - the status code.
      • isDownloadCompleted

         boolean isDownloadCompleted(@NonNull() Long requestSetKey)

        Checks if the DownloadRequestSet is completed.

        Parameters:
        requestSetKey - the Download Request Set key.
      • findCurrentDownloadBatchInProgress

         List<DownloadRequest> findCurrentDownloadBatchInProgress(int batchSize)

        Finds the current set of download request which are still being processed.

        Parameters:
        batchSize - the maximum number of entities to fetch
      • toVideoList

         static List<Video> toVideoList(@NonNull() List<OfflineVideo> entityList)

        Converts the given list of OfflineVideo objects into a list of Video objects.

        Parameters:
        entityList - the list to be converted.