public class OfflineStoreManager extends BaseStore
| Modifier and Type | Class and Description |
|---|---|
static interface |
OfflineStoreManager.CanChangeDownloadIdentifier
Any method attempting to call
changeDownloadIdentifier(Video) must be annotated explicitly with
this annotation. |
context, dataStore, MAX_SQL_EXPRESSIONS, MAX_SQL_VARIABLES, source| Modifier and Type | Method and Description |
|---|---|
com.brightcove.player.store.DownloadRequestSet |
addDownloadRequests(com.brightcove.player.store.DownloadRequestSet requestSet,
IDownloadManager.IRequest... requests)
Creates a new blank download request set.
|
com.brightcove.player.store.OfflineVideo |
changeDownloadIdentifier(Video video)
Changes the download identifier associated with given video.
|
int |
countDownloadRequestsInState(java.lang.Long requestSetKey,
int statusCode)
Counts the download requests belonging to a DownloadRequestSet with the specified status code.
|
com.brightcove.player.store.DownloadRequestSet |
createDownloadRequestSet(RequestConfig requestConfig,
long estimatedSize)
Creates a new blank download request set.
|
boolean |
deleteDownloadRequestSet(java.lang.Long key)
Deletes the specified request set from the store.
|
boolean |
deleteOfflineVideo(java.lang.String videoId)
Deletes the first offline video entity with the given video identifier.
|
java.util.List<com.brightcove.player.store.OfflineVideo> |
findAllOfflineVideo()
Finds all offline video entities.
|
java.util.List<com.brightcove.player.store.OfflineVideo> |
findAllOfflineVideo(int status)
Finds all offline video entities with the specified status
|
java.util.List<com.brightcove.player.store.DownloadRequest> |
findCurrentDownloadBatchInProgress(int batchSize)
Finds the current set of download request which are still being processed.
|
java.util.List<com.brightcove.player.store.DownloadRequestSet> |
findCurrentDownloadRequestSetInProgress()
Finds the current set of download request set which are still being processed.
|
com.brightcove.player.store.DownloadRequestSet |
findDownloadRequestSetByKey(java.lang.Long key)
Finds a download request set with the specified unique key.
|
java.util.Collection<com.brightcove.player.store.DownloadRequestSet> |
findDownloadRequestSets(java.lang.Long... requestIds)
Finds the download request sets to which the given requests belong to.
|
java.util.List<com.brightcove.player.store.DownloadRequest> |
findDownloadsToBeQueued(int batchSize,
boolean excludeWifiOnly)
Fetches a list of download requests that not have been queued for download by the
DownloadManager. |
android.net.Uri |
findOfflineAssetUri(android.net.Uri uri)
Finds the local URI of a remote asset that has been downloaded successfully.
|
com.brightcove.player.store.OfflineVideo |
findOfflineVideo(java.lang.String videoId)
Finds the first offline video entity with the given video identifier.
|
static OfflineStoreManager |
getInstance(android.content.Context context)
Gets reference to the single instance of
OfflineStoreManager |
boolean |
isCurrentDownloadBatchInProgress()
Checks if the current set of download request are still being processed.
|
boolean |
isDownloadCompleted(java.lang.Long requestSetKey)
Checks if the DownloadRequestSet is completed.
|
java.util.List<com.brightcove.player.store.DownloadRequest> |
markRequestSetForRemoval(java.lang.Long key)
Marks the specified request set for removal.
|
java.util.List<com.brightcove.player.store.DownloadRequest> |
pauseDownloadRequestSet(java.lang.Long key)
Marks a download request set as paused.
|
<E extends IdentifiableEntity> |
refreshEntity(E entity)
Refresh the given entity.
|
com.brightcove.player.store.DownloadRequestSet |
resumeDownloadRequestSet(java.lang.Long key)
Marks a download request set as waiting to be queued.
|
<T extends IdentifiableEntity> |
saveEntity(T entity)
Inserts or updates the given entity.
|
com.brightcove.player.store.OfflineVideo |
saveOfflineLicense(Video video)
Updates the entity with given unique video identifier to save the video license information.
|
com.brightcove.player.store.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.
|
com.brightcove.player.store.OfflineVideo |
saveOfflineVideo(Video video,
java.io.File downloadDirectory,
com.brightcove.player.store.DownloadRequestSet requestSet)
Saves the offline video information into the store.
|
static java.util.List<Video> |
toVideoList(java.util.List<com.brightcove.player.store.OfflineVideo> entityList)
Converts the given list of
OfflineVideo objects into a list of Video
objects. |
boolean |
updateDownloadId(java.lang.Long key,
java.lang.Long downloadId)
Sets the download identifier for the request with the specified primary key.
|
com.brightcove.player.store.OfflineVideo |
updateDownloadRequestIdList(java.lang.String videoId,
java.util.List<java.lang.Long> requestIdList,
long estimatedSize)
Updates the entity with given unique video identifier to save the current list of download
request identifiers.
|
boolean |
updateDownloadRequestSetStatus(com.brightcove.player.store.DownloadRequestSet requestSet,
int statusCode,
int reasonCode,
com.brightcove.player.store.DownloadRequest downloadRequest,
boolean evaluateAllSegments)
Updates the status of Download Request Set.
|
com.brightcove.player.store.DownloadRequest |
updateDownloadRequestStatusByDownloadId(java.lang.Long downloadId,
int statusCode,
int reasonCode,
long bytesDownloaded,
long actualSize,
boolean updateParentRecord)
Updates the status of download request.
|
compact, deleteEntity, getDefaultDatabaseName, getDefaultDatabasePassword, getFileSize, onCreated, onUpgradedpublic static OfflineStoreManager getInstance(@NonNull android.content.Context context)
OfflineStoreManagercontext - reference to the host application context.OfflineStoreManager@Nullable public <E extends IdentifiableEntity> E refreshEntity(@Nullable E entity)
refreshEntity in class BaseStoreE - the expected type of the entity;entity - reference to the entity to be refreshed.public <T extends IdentifiableEntity> T saveEntity(@NonNull T entity)
saveEntity in class BaseStoreentity - the entity to be save.@Nullable
public com.brightcove.player.store.OfflineVideo updateDownloadRequestIdList(@NonNull
java.lang.String videoId,
@Nullable
java.util.List<java.lang.Long> requestIdList,
long estimatedSize)
videoId - the unique video identifier.requestIdList - a list of download request identifiers.public com.brightcove.player.store.OfflineVideo saveOfflineVideo(@NonNull
Video video,
@NonNull
java.io.File downloadDirectory,
@NonNull
com.brightcove.player.store.DownloadRequestSet requestSet)
video - the video information to be saved.downloadDirectory - the download directory for this video.requestSet - the download request set related to this video.@NonNull public com.brightcove.player.store.OfflineVideo saveOfflineVideo(Video video)
video - the video to be saved.saveOfflineLicense(Video)@NonNull
public com.brightcove.player.store.OfflineVideo saveOfflineLicense(@NonNull
Video video)
video - the video to be saved.saveOfflineVideo(Video)@Nullable
public com.brightcove.player.store.OfflineVideo findOfflineVideo(@NonNull
java.lang.String videoId)
videoId - the unique video identifier.@NonNull public java.util.List<com.brightcove.player.store.OfflineVideo> findAllOfflineVideo()
@NonNull public java.util.List<com.brightcove.player.store.OfflineVideo> findAllOfflineVideo(int status)
public boolean deleteOfflineVideo(@NonNull
java.lang.String videoId)
videoId - the unique video identifier.@NonNull
public com.brightcove.player.store.DownloadRequestSet createDownloadRequestSet(@Nullable
RequestConfig requestConfig,
long estimatedSize)
@NonNull
public com.brightcove.player.store.DownloadRequestSet addDownloadRequests(@NonNull
com.brightcove.player.store.DownloadRequestSet requestSet,
@NonNull
IDownloadManager.IRequest... requests)
@Nullable
public com.brightcove.player.store.DownloadRequestSet findDownloadRequestSetByKey(@NonNull
java.lang.Long key)
key - the primary key of the request set.@Nullable
public android.net.Uri findOfflineAssetUri(@Nullable
android.net.Uri uri)
uri - the remote URI to the asset.public java.util.Collection<com.brightcove.player.store.DownloadRequestSet> findDownloadRequestSets(@NonNull
java.lang.Long... requestIds)
requestIds - an array of one or more download requests.public boolean deleteDownloadRequestSet(@NonNull
java.lang.Long key)
key - the primary key of the request set to be deleted.@Nullable
public com.brightcove.player.store.DownloadRequest updateDownloadRequestStatusByDownloadId(@NonNull
java.lang.Long downloadId,
int statusCode,
int reasonCode,
long bytesDownloaded,
long actualSize,
boolean updateParentRecord)
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.public boolean updateDownloadRequestSetStatus(com.brightcove.player.store.DownloadRequestSet requestSet,
int statusCode,
int reasonCode,
com.brightcove.player.store.DownloadRequest downloadRequest,
boolean evaluateAllSegments)
requestSet - the Download Request SetstatusCode - the new status of the download segment.reasonCode - the reason code for the new status, if any.downloadRequest - the new segment Download RequestevaluateAllSegments - if true, it makes sure to evaluate all download request segments to get the overall status.@NonNull
public java.util.List<com.brightcove.player.store.DownloadRequest> pauseDownloadRequestSet(@NonNull
java.lang.Long key)
key - the primary key of the request set to be paused.@Nullable
public com.brightcove.player.store.DownloadRequestSet resumeDownloadRequestSet(@NonNull
java.lang.Long key)
key - the primary key of the request set to be paused.public boolean updateDownloadId(@NonNull
java.lang.Long key,
java.lang.Long downloadId)
key - the primary key of the request to be updated.downloadId - the unique identifier to the download request in the DownloadManager@Nullable
public com.brightcove.player.store.OfflineVideo changeDownloadIdentifier(@NonNull
Video video)
video - reference to the video.@NonNull
public java.util.List<com.brightcove.player.store.DownloadRequest> markRequestSetForRemoval(@NonNull
java.lang.Long key)
key - the primary key of the request set to be updated.@NonNull
public java.util.List<com.brightcove.player.store.DownloadRequest> findDownloadsToBeQueued(int batchSize,
boolean excludeWifiOnly)
DownloadManager.batchSize - the maximum number of entities to fetch.excludeWifiOnly - true if the requests that allowed only on wifi networks must be excluded, otherwise false.public boolean isCurrentDownloadBatchInProgress()
public int countDownloadRequestsInState(@NonNull
java.lang.Long requestSetKey,
int statusCode)
requestSetKey - the Download Request Set key.statusCode - the status code.public boolean isDownloadCompleted(@NonNull
java.lang.Long requestSetKey)
requestSetKey - the Download Request Set key.public java.util.List<com.brightcove.player.store.DownloadRequest> findCurrentDownloadBatchInProgress(int batchSize)
batchSize - the maximum number of entities to fetchpublic java.util.List<com.brightcove.player.store.DownloadRequestSet> findCurrentDownloadRequestSetInProgress()