Class AbstractOfflineCatalog
- All Implemented Interfaces:
Component
- Direct Known Subclasses:
OfflineCatalog
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
An abstract Builder which sets the bases to create the OfflineCatalog object.Nested classes/interfaces inherited from class com.brightcove.player.edge.Catalog
Catalog.AbstractBuilder<T extends Catalog.AbstractBuilder<T>>
-
Field Summary
Fields inherited from class com.brightcove.player.edge.Catalog
DEFAULT_EDGE_BASE_URL, DEFAULT_EPA_BASE_URL, INSTANCE
Fields inherited from class com.brightcove.player.event.AbstractComponent
eventEmitter, listenerTokens
-
Constructor Summary
ModifierConstructorDescriptionAbstractOfflineCatalog
(android.content.Context context, EventEmitter eventEmitter, String account, String policy, String baseURL) Deprecated.AbstractOfflineCatalog
(android.content.Context context, EventEmitter eventEmitter, String account, String policy, String baseURL, DownloadFileCreator downloadFileCreator) Deprecated.protected
AbstractOfflineCatalog
(AbstractOfflineCatalog.Builder<?> builder) The Catalog constructor using theAbstractOfflineCatalog.Builder
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDownloadEventListener
(MediaDownloadable.DownloadEventListener downloadEventListener) Adds the specified to the list of listeners that will be notified when a download event is raised.boolean
cancelVideoDownload
(Video video) Cancels a video download that has not been completed yet.void
cancelVideoDownload
(Video video, OfflineCallback<Boolean> callback) Asynchronously cancels a video download that has not been completed yet.boolean
cancelVideoDownload
(String videoId) Cancels a video download that has not been completed yet.void
cancelVideoDownload
(String videoId, OfflineCallback<Boolean> callback) Asynchronously cancels a video download that has not been completed yet.boolean
deleteVideo
(Video video) This method can be used to remove all assets related to a single video from the host device.void
deleteVideo
(Video video, OfflineCallback<Boolean> callback) Asynchronously deletes the offline copy of the specified video.boolean
deleteVideo
(String videoId) Deletes the offline copy of the specified video.void
deleteVideo
(String videoId, OfflineCallback<Boolean> callback) Asynchronously deletes the offline copy of the specified video.downloadVideo
(Video video) This method is used to request a single video to be downloaded for offline playback.void
downloadVideo
(Video video, OfflineCallback<DownloadStatus> callback) This method is used to request a single video to be downloaded asynchronously for offline playback.long
estimateSize
(Video video) This method returns the approximate total size for a Video already downloaded or with a download in progress.void
estimateSize
(Video video, MediaDownloadable.OnVideoSizeCallback callback) This method is used to determine the approximate total size of all assets needed to store the video on the host device.This method returns the list of videos that have been queued for download.void
findAllQueuedVideoDownload
(OfflineCallback<List<Video>> callback) Asynchronously returns the list of videos that have been queued for download.findAllVideoDownload
(int status) Finds all offline video downloads with specified status.void
findAllVideoDownload
(int status, OfflineCallback<List<Video>> callback) Asynchronously finds all offline video downloads with specified status.findOfflineVideoById
(String videoId) Finds the offline copy of the specified video, if it exists.void
findOfflineVideoById
(String videoId, OfflineCallback<Video> callback) Asynchronously finds the offline copy of the specified video, if it exists.findOfflineVideoById
(String videoId, HttpRequestConfig httpRequestConfig) Finds the offline copy of the specified video, if it exists.void
findOfflineVideoById
(String videoId, HttpRequestConfig httpRequestConfig, OfflineCallback<Video> callback) Asynchronously finds the offline copy of the specified video, if it exists.Gets the current base path that will be used to store new offline video requests.void
getMediaFormatTracksAvailable
(Video video, MediaDownloadable.MediaFormatListener mediaFormatListener) An asynchronous call to retrieve the MediaFormat tracks available for a given video.getVideoDownloadStatus
(Video video) Gets the status of previous video download request.void
getVideoDownloadStatus
(Video video, OfflineCallback<DownloadStatus> callback) Asynchronously gets the status of previous video download request.getVideoDownloadStatus
(String videoId) Gets the status of previous video download request.void
getVideoDownloadStatus
(String videoId, OfflineCallback<DownloadStatus> callback) Asynchronously gets the status of previous video download request.boolean
Checks whether the download path is valid.boolean
Returns whether download over a metered network is allowed.boolean
This method can be used to check if the SDK is currently configured to use a cellular network for downloading DRM media assets.boolean
This method can be used to check if the SDK is currently configured to use a cellular roaming network for downloading DRM media assets.boolean
isVideoDownloadable
(Video video) Checks if the video parameter can be downloaded and the directory to store the downloaded video files is valid.int
pauseVideoDownload
(Video video) This method is used to pause a single video being downloaded.void
pauseVideoDownload
(Video video, OfflineCallback<Integer> callback) This method is used to asynchronously pause a single video being downloaded.int
pauseVideoDownload
(String videoId) This method is used to pause a single video being downloaded.void
pauseVideoDownload
(String videoId, OfflineCallback<Integer> callback) This method is used to asynchronously pause a single video being downloaded.void
releaseLicense
(Video video, EventListener listener) Submits an offline playback license release request for the specified video asynchronously.void
removeDownloadEventListener
(MediaDownloadable.DownloadEventListener downloadEventListener) Removes the specified from the list of listeners that will be notified when a download event is raised.void
requestPurchaseLicense
(Video video, EventListener listener) Submits an offline playback purchase license request for the specified video asynchronously.void
requestPurchaseLicense
(Video video, EventListener listener, CustomerRightsTokenConfig config) Submits an offline playback purchase license request for the specified video asynchronously.void
requestPurchaseLicense
(Video video, EventListener listener, HttpRequestConfig httpRequestConfig) Submits an offline playback purchase license request for the specified video asynchronously.void
requestRentalLicense
(Video video, Date absoluteExpiration, long playDuration, EventListener listener) Submits an offline playback rental license request for the specified video asynchronously.void
requestRentalLicense
(Video video, Date absoluteExpiration, long playDuration, EventListener listener, CustomerRightsTokenConfig config) Submits an offline playback rental license request for the specified video asynchronously.void
requestRentalLicense
(Video video, Date absoluteExpiration, long playDuration, EventListener listener, HttpRequestConfig httpRequestConfig) Submits an offline playback rental license request for the specified video asynchronously.int
resumeVideoDownload
(Video video) This method is used to resume the download of a video which was previously paused.void
resumeVideoDownload
(Video video, OfflineCallback<Integer> callback) This method is used to asynchronously resume the download of a video which was previously paused.int
resumeVideoDownload
(String videoId) This method is used to resume a single video being downloaded which was previously paused.void
resumeVideoDownload
(String videoId, OfflineCallback<Integer> callback) This method is used to asynchronously resume the download of a video which was previously paused.void
setDownloadPath
(DownloadFileCreator downloadFileCreator) Sets theDownloadFileCreator
to retrieve the base path that must be used to store new offline video requests.void
setDownloadPath
(File downloadPath) Sets the base path that must be used to store new offline video requests.void
setMeteredDownloadAllowed
(boolean meteredDownloadAllowed) Sets whether download over a metered network is allowed.void
setMobileDownloadAllowed
(boolean mobileDownloadAllowed) This method can be used to configure the SDK whether the cellular network may be used to download DRM media assets or not.void
setRoamingDownloadAllowed
(boolean roamingDownloadAllowed) This method can be used to configure the SDK whether the cellular roaming network may be used downloading DRM media assets.void
setVideoBitrate
(int videoBitrate) Sets the video bitrate cap which will be used to determine what rendition will be downloaded.void
Terminates threads created to perform asynchronous operations.Methods inherited from class com.brightcove.player.edge.Catalog
empty, findPlaylistByID, findPlaylistByID, findPlaylistByID, findPlaylistByID, findPlaylistByReferenceID, findPlaylistByReferenceID, findPlaylistByReferenceID, findPlaylistByReferenceID, findVideoByID, findVideoByID, findVideoByID, findVideoByID, findVideoByReferenceID, findVideoByReferenceID, findVideoByReferenceID, findVideoByReferenceID, getInstance, getProperties
Methods inherited from class com.brightcove.player.event.AbstractComponent
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
-
Constructor Details
-
AbstractOfflineCatalog
@Deprecated public AbstractOfflineCatalog(android.content.Context context, EventEmitter eventEmitter, String account, String policy, String baseURL) Deprecated.Base constructor forAbstractOfflineCatalog
. Creates anExternalFileCreator
as itsDownloadFileCreator
.- Parameters:
context
- an instance of aContext
.eventEmitter
- an instance of anEventEmitter
.account
- Account id from VideoCloud.policy
- Policy Key from VideoCloud.baseURL
- Playback API base url.
-
AbstractOfflineCatalog
@Deprecated public AbstractOfflineCatalog(android.content.Context context, EventEmitter eventEmitter, String account, String policy, String baseURL, @NonNull DownloadFileCreator downloadFileCreator) Deprecated.Constructor forAbstractOfflineCatalog
with a customDownloadFileCreator
.- Parameters:
context
- an instance of aContext
.eventEmitter
- an instance of anEventEmitter
.account
- Account id from VideoCloud.policy
- Policy Key from VideoCloud.baseURL
- Playback API base url.downloadFileCreator
-DownloadFileCreator
to retrieve a directory to store offline content.
-
AbstractOfflineCatalog
The Catalog constructor using theAbstractOfflineCatalog.Builder
-
-
Method Details
-
getDownloadPath
Gets the current base path that will be used to store new offline video requests.- Returns:
- the download path.
-
setDownloadPath
Sets the base path that must be used to store new offline video requests. Changing the location will not change location of any downloads that are either currently being downloaded or have been downloaded already.
Please note that by default the
AbstractOfflineCatalog
uses a secure location on the host device that is accessible only by the host application and will be cleaned automatically, if the host application is uninstalled. If you change this path, the you will be responsible ensure it is secure and will be cleaned automaticallyThough Android OS will make an attempt to clean the download media placed this folder, the Android OS does not guarantee that will be in fact clean all the files.
- Parameters:
downloadPath
- the download path. Must be a file URI to a path on external storage, and the calling application must have the WRITE_EXTERNAL_STORAGE permission.- Throws:
InvalidDownloadPathException
- when the download path is not valid.- See Also:
-
setDownloadPath
public void setDownloadPath(@NonNull DownloadFileCreator downloadFileCreator) throws InvalidDownloadPathException Sets the
DownloadFileCreator
to retrieve the base path that must be used to store new offline video requests. Changing the location will not change location of any downloads that are either currently being downloaded or have been downloaded already.By default a
ExternalFileCreator
is created when calling the default constructor- Parameters:
downloadFileCreator
-to set
.- Throws:
InvalidDownloadPathException
- when the download path is not valid.- See Also:
-
isVideoDownloadable
Checks if the video parameter can be downloaded and the directory to store the downloaded video files is valid.
Suggestion: If your app has a download button use this method to check if you can show it.
- Parameters:
video
- Video to check if it is possible to download.- Returns:
- true if the video can be downloaded.
- See Also:
-
isDownloadPathValid
public boolean isDownloadPathValid()Checks whether the download path is valid.
- Returns:
- true if the download path is valid.
-
isMobileDownloadAllowed
public boolean isMobileDownloadAllowed()This method can be used to check if the SDK is currently configured to use a cellular network for downloading DRM media assets.By default the SDK will not use a cellular network. This setting must be enabled explicitly by the developer.
- Returns:
- true if cellular network is allowed.
-
setMobileDownloadAllowed
public void setMobileDownloadAllowed(boolean mobileDownloadAllowed) This method can be used to configure the SDK whether the cellular network may be used to download DRM media assets or not.The developer will be responsible to include the necessary logic in the host application to prompt the user and expose the setting to the user.
- Parameters:
mobileDownloadAllowed
- true if cellular network is allowed.
-
isRoamingDownloadAllowed
public boolean isRoamingDownloadAllowed()This method can be used to check if the SDK is currently configured to use a cellular roaming network for downloading DRM media assets.By default the SDK will not use cellular roaming network. This setting must be enabled explicitly by the developer.
- Returns:
- true if roaming is allowed.
-
setRoamingDownloadAllowed
public void setRoamingDownloadAllowed(boolean roamingDownloadAllowed) This method can be used to configure the SDK whether the cellular roaming network may be used downloading DRM media assets.The developer will be responsible to include the necessary logic in the host application to prompt the user and expose the setting to the user.
- Parameters:
roamingDownloadAllowed
- true if roaming is allowed.
-
isMeteredDownloadAllowed
public boolean isMeteredDownloadAllowed()Returns whether download over a metered network is allowed. By default the SDK will not use a metered network.- Returns:
- true if allowed
- See Also:
-
setMeteredDownloadAllowed
public void setMeteredDownloadAllowed(boolean meteredDownloadAllowed) Sets whether download over a metered network is allowed.- Parameters:
meteredDownloadAllowed
- whether metered is allowed
-
setVideoBitrate
public 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
-
addDownloadEventListener
public void addDownloadEventListener(@NonNull MediaDownloadable.DownloadEventListener downloadEventListener) Adds the specified to the list of listeners that will be notified when a download event is raised.- Parameters:
downloadEventListener
- the download event listener- See Also:
-
removeDownloadEventListener
public void removeDownloadEventListener(@NonNull MediaDownloadable.DownloadEventListener downloadEventListener) Removes the specified from the list of listeners that will be notified when a download event is raised.- Parameters:
downloadEventListener
- the download event listener- See Also:
-
estimateSize
This method returns the approximate total size for a Video already downloaded or with a download in progress. The estimate will include the size of the video, subtitles and other assets such as thumbnails. The actual size of the video on the host device may vary based on the partition type and format of the storage. If you attempt to get the estimated size for a Video that has not been downloaded, you will get a size of 0. Use theestimateSize(Video, MediaDownloadable.OnVideoSizeCallback)
for this scenario.- Parameters:
video
- - reference to the video to be estimated.- Returns:
- the size of the video
- See Also:
-
estimateSize
public void estimateSize(@NonNull Video video, @NonNull MediaDownloadable.OnVideoSizeCallback callback) throws InvalidDownloadPathException This method is used to determine the approximate total size of all assets needed to store the video on the host device. The estimate will include the size of the video, subtitles and other assets such as thumbnails. The actual size of the video on the host device may vary based on the partition type and format of the storage. NOTE: This method requires the Media Manifest to retrieve the requested information, therefore it might download the manifest and store it to the directory provided bygetDownloadPath()
, if it has not been done already. If this directory is invalid, it will throw aInvalidDownloadPathException
.- Parameters:
video
- reference to the video to be estimated.callback
- to return the video size.- Throws:
InvalidDownloadPathException
- when the current download path is invalid.- See Also:
-
getMediaFormatTracksAvailable
public void getMediaFormatTracksAvailable(@NonNull Video video, @NonNull MediaDownloadable.MediaFormatListener mediaFormatListener) throws InvalidDownloadPathException An asynchronous call to retrieve the MediaFormat tracks available for a given video. The result will be given through theMediaDownloadable.MediaFormatListener
listener.NOTE: Only the video type
DeliveryType.DASH
is currently supported. This method requires the Media Manifest to retrieve the requested information, therefore it might download the manifest and store it to the directory provided bygetDownloadPath()
, if it has not been done already. If this directory is invalid, it will throw aInvalidDownloadPathException
.- Parameters:
video
- video to retrieve MediaFormatTracks from.mediaFormatListener
- callback to returnMediaDownloadable
- Throws:
InvalidDownloadPathException
- when the current download path is invalid.
-
downloadVideo
This method is used to request a single video to be downloaded for offline playback. Operations to initialize the download will block the UI thread. For asynchronous version usedownloadVideo(Video, OfflineCallback)
.Please register a
MediaDownloadable.DownloadEventListener
to receive notifications when the download is completed, cancelled or failed.In case the download path is not available, this method will fail by calling
MediaDownloadable.DownloadEventListener.onDownloadFailed(Video, DownloadStatus)
with the requested video and aDownloadStatus.StatusCode
=DownloadStatus.STATUS_NOT_QUEUED
andDownloadStatus.ReasonCode
=DownloadStatus.ERROR_DEVICE_NOT_FOUND
. The sameDownloadStatus
instance will be returned in the method.- Parameters:
video
- to be downloaded.- Returns:
DownloadStatus
with the current state of the download.- See Also:
-
downloadVideo
This method is used to request a single video to be downloaded asynchronously for offline playback.Please register a
In case the download path is not available, this method will fail by callingMediaDownloadable.DownloadEventListener
to receive notifications when the download is completed, cancelled or failed.MediaDownloadable.DownloadEventListener.onDownloadFailed(Video, DownloadStatus)
with the requested video and aDownloadStatus.StatusCode
=DownloadStatus.STATUS_NOT_QUEUED
andDownloadStatus.ReasonCode
=DownloadStatus.ERROR_DEVICE_NOT_FOUND
. The sameDownloadStatus
instance will be returned in the method.- Parameters:
video
- The video to be downloaded.callback
- Provides the result of the operation. In case the download of the requested video is started successfully,OfflineCallback.onSuccess(Object)
will be called to provide theDownloadStatus
, otherwiseOfflineCallback.onFailure(Throwable)
will be called.- See Also:
-
cancelVideoDownload
Cancels a video download that has not been completed yet. Operations to cancel the video download will block the UI thread. For asynchronous version use
cancelVideoDownload(Video, OfflineCallback)
. If the video has been downloaded already, then calling this method will have no effect. Please calldeleteVideo(Video)
method instead to delete the video.- Parameters:
video
- the video to be cancelled.- Returns:
- true if the download was found in the download queue and removed, otherwise false.
- See Also:
-
cancelVideoDownload
Asynchronously cancels a video download that has not been completed yet. If the video has been downloaded already, then calling this method will have no effect. Please call
deleteVideo(Video)
method instead to delete the video.- Parameters:
video
- The video to be cancelled.callback
- Provides the result of the operation. In case the download of the requested video has been canceled successfully,OfflineCallback.onSuccess(Object)
will be called to provide aBoolean
with its value as 'true' if the download was found in the download queue and removed, otherwise 'false'.OfflineCallback.onFailure(Throwable)
will be called in case there was an error.
-
cancelVideoDownload
Cancels a video download that has not been completed yet. Operations to cancel the video download will block the UI thread. For asynchronous version use
cancelVideoDownload(String, OfflineCallback)
. If the video has been downloaded already, then calling this method will have no effect. Please calldeleteVideo(Video)
method instead to delete the video.- Parameters:
videoId
- the video id.- Returns:
- true if the download was found in the download queue and removed, otherwise false.
- See Also:
-
cancelVideoDownload
public void cancelVideoDownload(@NonNull String videoId, @NonNull OfflineCallback<Boolean> callback) Asynchronously cancels a video download that has not been completed yet. If the video has been downloaded already, then calling this method will have no effect. Please call
deleteVideo(Video)
method instead to delete the video.- Parameters:
videoId
- The id of the video to be cancelled.callback
- Provides the result of the operation. In case the download of the requested video has been canceled successfully,OfflineCallback.onSuccess(Object)
will be called to provide aBoolean
with its value as 'true' if the download was found in the download queue and removed, otherwise 'false'.OfflineCallback.onFailure(Throwable)
will be called in case there was an error.
-
pauseVideoDownload
This method is used to pause a single video being downloaded. Operations to pause the video download will block the UI thread. For asynchronous version usepauseVideoDownload(Video, OfflineCallback)
.- Parameters:
video
- the video to be paused.- Returns:
- the current status of the video download.
- Throws:
UnsupportedOperationException
- if the underlying download process does not support pausing video downloads.- See Also:
-
pauseVideoDownload
This method is used to asynchronously pause a single video being downloaded.- Parameters:
video
- The video to be paused.callback
- Provides the result of the operation. In case the download of the requested video has been paused successfully,OfflineCallback.onSuccess(Object)
will be called to provide anInteger
value of its currentDownloadStatus.StatusCode
.OfflineCallback.onFailure(Throwable)
will be called in case there was an error.
-
pauseVideoDownload
This method is used to pause a single video being downloaded. Operations to pause the video download will block the UI thread. For asynchronous version usepauseVideoDownload(String, OfflineCallback)
.- Parameters:
videoId
- the video id.- Returns:
- the current status of the video download.
- Throws:
UnsupportedOperationException
- if the underlying download process does not support pausing video downloads.- See Also:
-
pauseVideoDownload
This method is used to asynchronously pause a single video being downloaded.- Parameters:
videoId
- The id of the video to be paused.callback
- Provides the result of the operation. In case the download of the requested video has been paused successfully,OfflineCallback.onSuccess(Object)
will be called to provide anInteger
value of its currentDownloadStatus.StatusCode
.OfflineCallback.onFailure(Throwable)
will be called in case there was an error.
-
resumeVideoDownload
This method is used to resume the download of a video which was previously paused. Operations to resume the video download will block the UI thread. For asynchronous version useresumeVideoDownload(Video, OfflineCallback)
.- Parameters:
video
- the video to resume its download.- Throws:
UnsupportedOperationException
- if the underlying download process does not support pausing video downloads.- See Also:
-
resumeVideoDownload
This method is used to asynchronously resume the download of a video which was previously paused.- Parameters:
video
- the video to resume its download.callback
- Provides the result of the operation. In case the download of the requested video has been resumed successfully,OfflineCallback.onSuccess(Object)
will be called to provide anInteger
value of its currentDownloadStatus.StatusCode
.OfflineCallback.onFailure(Throwable)
will be called in case there was an error.UnsupportedOperationException
if the underlying download process does not support pausing video downloads.
-
resumeVideoDownload
This method is used to resume a single video being downloaded which was previously paused. Operations to resume the video download will block the UI thread. For asynchronous version useresumeVideoDownload(String, OfflineCallback)
.- Parameters:
videoId
- the video id.- Returns:
- the current status of the video download.
- Throws:
UnsupportedOperationException
- if the underlying download process does not support pausing video downloads.- See Also:
-
resumeVideoDownload
public void resumeVideoDownload(@NonNull String videoId, @NonNull OfflineCallback<Integer> callback) This method is used to asynchronously resume the download of a video which was previously paused.- Parameters:
videoId
- the Id of the video to resume its download.callback
- Provides the result of the operation. In case the download of the requested video has been resumed successfully,OfflineCallback.onSuccess(Object)
will be called to provide anInteger
value of its currentDownloadStatus.StatusCode
.OfflineCallback.onFailure(Throwable)
will be called in case there was an error.UnsupportedOperationException
if the underlying download process does not support pausing video downloads.
-
deleteVideo
This method can be used to remove all assets related to a single video from the host device. Deleting a video download will not cause the license to be deleted/released. Please callreleaseLicense(Video, EventListener)
to release and remove the license. Operations to delete the video download will block the UI thread. For asynchronous version usedeleteVideo(Video, OfflineCallback)
.- Parameters:
video
- to be deleted.- Returns:
- true if the video was found in the download queue and deleted, otherwise false.
- See Also:
-
deleteVideo
Asynchronously deletes the offline copy of the specified video. If the video has not been fully downloaded yet, then it will be removed from the download queue and any partially download assets belonging to the video will be deleted. The developer is responsible for either releasing any license key set identifier attached to the video usingreleaseLicense(Video, EventListener)
or saving the license key set identifier for future reuse.- Parameters:
video
- The video to be deleted.callback
- Provides the result of the operation. In case the video has been successfully removed,will be called to provide a {@link Boolean} with its value as 'true' if the video was deleted, otherwise 'false'. {@link OfflineCallback#onFailure(Throwable)} will be called in case there was an error.
-
deleteVideo
Deletes the offline copy of the specified video. If the video has not been fully downloaded yet, then it will be removed from the download queue and any partially download assets belonging to the video will be deleted. The developer is responsible for either releasing any license key set identifier attached to the video usingreleaseLicense(Video, EventListener)
or saving the license key set identifier for future reuse. Operations to delete the video download will block the UI thread. For asynchronous version usedeleteVideo(String, OfflineCallback)
.- Parameters:
videoId
- the unique identified of the video to be deleted.- Returns:
- true if the video was removed from the download queue and the storage, otherwise false.
- See Also:
-
deleteVideo
Asynchronously deletes the offline copy of the specified video. If the video has not been fully downloaded yet, then it will be removed from the download queue and any partially download assets belonging to the video will be deleted. The developer is responsible for either releasing any license key set identifier attached to the video usingreleaseLicense(Video, EventListener)
or saving the license key set identifier for future reuse.- Parameters:
videoId
- The Id of the video to be deleted.callback
- Provides the result of the operation. In case the video has been successfully removed,will be called to provide a {@link Boolean} with its value as 'true' if the video was deleted, otherwise 'false'. {@link OfflineCallback#onFailure(Throwable)} will be called in case there was an error.
-
getVideoDownloadStatus
Gets the status of previous video download request. Please note that this is a blocking call. Checking the status of large video with multiple assets may take time. Operations to retrieve the video download status will block the UI thread. For asynchronous version usegetVideoDownloadStatus(Video, OfflineCallback)
.- Parameters:
video
- the video being downloaded.- Returns:
- the video download status.
- See Also:
-
getVideoDownloadStatus
public void getVideoDownloadStatus(@NonNull Video video, @NonNull OfflineCallback<DownloadStatus> callback) Asynchronously gets the status of previous video download request. Please note that this is a blocking call. Checking the status of large video with multiple assets may take time.- Parameters:
video
- The video whichDownloadStatus
will be retrieved.callback
- Provides the result of the operation. In case theDownloadStatus
has been retrieved successfully,will be called to provide the {@link DownloadStatus} from the requested video. {@link OfflineCallback#onFailure(Throwable)} will be called in case there was an error.
-
getVideoDownloadStatus
Gets the status of previous video download request. Please note that this is a blocking call. Checking the status of large video with multiple assets may take time. Operations to retrieve the video download status will block the UI thread. For asynchronous version usegetVideoDownloadStatus(String, OfflineCallback)
.- Parameters:
videoId
- The id of the video whichDownloadStatus
will be retrieved.- Returns:
- the video download status.
- See Also:
-
getVideoDownloadStatus
public void getVideoDownloadStatus(@NonNull String videoId, @NonNull OfflineCallback<DownloadStatus> callback) Asynchronously gets the status of previous video download request. Please note that this is a blocking call. Checking the status of large video with multiple assets may take time.- Parameters:
videoId
- The id of the video whichDownloadStatus
will be retrieved.callback
- Provides the result of the operation. In case theDownloadStatus
has been retrieved successfully,will be called to provide the {@link DownloadStatus} from the requested video. {@link OfflineCallback#onFailure(Throwable)} will be called in case there was an error.
-
findAllQueuedVideoDownload
This method returns the list of videos that have been queued for download. The result will include all videos that have been placed in the download queue, including those that have been downloaded successfully. Please callgetVideoDownloadStatus(Video)
to find the current download status of each video. Operations to retrieve the queued videos will block the UI thread. For asynchronous version usefindAllQueuedVideoDownload(OfflineCallback)
.- Returns:
- the list of enqueued videos for download.
- See Also:
-
findAllQueuedVideoDownload
Asynchronously returns the list of videos that have been queued for download. The result will include all videos that have been placed in the download queue, including those that have been downloaded successfully. Please callgetVideoDownloadStatus(Video)
to find the current download status of each video.- Parameters:
callback
- Provides the result of the operation.will be called to provide the {@link List<OfflineVideo>} of the queued videos. {@link OfflineCallback#onFailure(Throwable)} will be called in case there was an error.
-
findAllVideoDownload
Finds all offline video downloads with specified status. Operations to retrieve all videos will block the UI thread. For asynchronous version usefindAllVideoDownload(int, OfflineCallback)
.- Parameters:
status
- the status of the video download.- Returns:
- the list of completed video downloads.
- See Also:
-
findAllVideoDownload
Asynchronously finds all offline video downloads with specified status.- Parameters:
status
- the status of the video download.callback
- Provides the result of the operation.will be called to provide the {@link List<Video>} with the specified {@link com.brightcove.player.network.DownloadStatus.StatusCode}. {@link OfflineCallback#onFailure(Throwable)} will be called in case there was an error.
-
findOfflineVideoById
Finds the offline copy of the specified video, if it exists. Please note that a non-null return value does not mean the video has been completely downloaded. Please usegetVideoDownloadStatus(Video)
method to determine the current status of the offline copy. Operations to retrieve the video will block the UI thread. For asynchronous version usefindOfflineVideoById(String, OfflineCallback)
.- Parameters:
videoId
- the video id.- Returns:
- null if the offline copy of video was not found, otherwise the offline copy of the video
- See Also:
-
findOfflineVideoById
@Nullable public Video findOfflineVideoById(String videoId, @NonNull HttpRequestConfig httpRequestConfig) Finds the offline copy of the specified video, if it exists. Please note that a non-null return value does not mean the video has been completely downloaded. Please usegetVideoDownloadStatus(Video)
method to determine the current status of the offline copy. Operations to retrieve the video will block the UI thread. For asynchronous version usefindOfflineVideoById(String, HttpRequestConfig, OfflineCallback)
.- Parameters:
videoId
- The id of the video to retrieve.httpRequestConfig
- Http parameters when retrieving the video. UseHttpRequestConfig.empty()
instead of null.- Returns:
- null if the offline copy of video was not found, otherwise the offline copy of the video.
-
findOfflineVideoById
Asynchronously finds the offline copy of the specified video, if it exists. Please note that a non-null return value does not mean the video has been completely downloaded. Please usegetVideoDownloadStatus(Video)
method to determine the current status of the offline copy.- Parameters:
videoId
- The id of the video to retrieve.callback
- Provides the result of the operation.will be called to provide the {@link Video} requested or null if the video was not found. {@link OfflineCallback#onFailure(Throwable)} will be called in case there was an error.
-
findOfflineVideoById
public void findOfflineVideoById(String videoId, @NonNull HttpRequestConfig httpRequestConfig, @NonNull OfflineCallback<Video> callback) Asynchronously finds the offline copy of the specified video, if it exists. Please note that a non-null return value does not mean the video has been completely downloaded. Please usegetVideoDownloadStatus(Video)
method to determine the current status of the offline copy.- Parameters:
videoId
- The id of the video to retrieve.httpRequestConfig
- Http parameters when retrieving the video. UseHttpRequestConfig.empty()
instead of null.callback
- Provides the result of the operation.will be called to provide the {@link Video} requested or null if the video was not found.
-
requestRentalLicense
public void requestRentalLicense(@NonNull Video video, @NonNull Date absoluteExpiration, long playDuration, @NonNull EventListener listener) Submits an offline playback rental license request for the specified video asynchronously. Upon successful acquisition of license, the video object will be updated to set the license key set identifier and actual expiration date.- Parameters:
video
- the video for which the offline playback license should be acquired.absoluteExpiration
- defines how long the license is valid to start playback.playDuration
- defines in milliseconds how long the content can be consumed after the start of playback.listener
- reference to a listener that will be notified about the outcome of the request.
-
requestRentalLicense
public void requestRentalLicense(@NonNull Video video, @NonNull Date absoluteExpiration, long playDuration, @NonNull EventListener listener, @NonNull CustomerRightsTokenConfig config) Submits an offline playback rental license request for the specified video asynchronously. Upon successful acquisition of license, the video object will be updated to set the license key set identifier and actual expiration date.- Parameters:
video
- the video for which the offline playback license should be acquired.absoluteExpiration
- defines how long the license is valid to start playback.playDuration
- defines in milliseconds how long the content can be consumed after the start of playback.listener
- reference to a listener that will be notified about the outcome of the request.config
- defines additional configuration for the license request
-
requestRentalLicense
public void requestRentalLicense(@NonNull Video video, @NonNull Date absoluteExpiration, long playDuration, @NonNull EventListener listener, @NonNull HttpRequestConfig httpRequestConfig) Submits an offline playback rental license request for the specified video asynchronously. Upon successful acquisition of license, the video object will be updated to set the license key set identifier and actual expiration date.- Parameters:
video
- the video for which the offline playback license should be acquired.absoluteExpiration
- defines how long the license is valid to start playback.playDuration
- defines in milliseconds how long the content can be consumed after the start of playback.listener
- reference to a listener that will be notified about the outcome of the request.httpRequestConfig
- Http parameters when retrieving the video. UseHttpRequestConfig.empty()
instead of null.
-
requestPurchaseLicense
Submits an offline playback purchase license request for the specified video asynchronously. Upon successful acquisition of license, the video object will be updated to set the license key set identifier and actual expiration date.- Parameters:
video
- the video for which the offline playback license should be acquired.listener
- reference to a listener that will be notified about the outcome of the request.
-
requestPurchaseLicense
public void requestPurchaseLicense(@NonNull Video video, @NonNull EventListener listener, @NonNull CustomerRightsTokenConfig config) Submits an offline playback purchase license request for the specified video asynchronously. Upon successful acquisition of license, the video object will be updated to set the license key set identifier and actual expiration date.- Parameters:
video
- the video for which the offline playback license should be acquired.listener
- reference to a listener that will be notified about the outcome of the request.config
- defines additional configuration for the license request
-
requestPurchaseLicense
public void requestPurchaseLicense(@NonNull Video video, @NonNull EventListener listener, @NonNull HttpRequestConfig httpRequestConfig) Submits an offline playback purchase license request for the specified video asynchronously. Upon successful acquisition of license, the video object will be update to set the license key set identifier and actual expiration date.- Parameters:
video
- the video for which the offline playback license should be acquired.listener
- reference to a listener that will be notified about the outcome of the request.httpRequestConfig
- additional parameters for the license request.
-
releaseLicense
Submits an offline playback license release request for the specified video asynchronously. Upon successful release of license, the video object will be update to remove the license key set identifier and expiration date.- Parameters:
video
- the video for which the offline playback license should be released.listener
- reference to a listener that will be notified about the outcome of the request.
-
terminate
public void terminate()Terminates threads created to perform asynchronous operations. After calling this method the OfflineCatalog should not be used, instead a new instance of an OfflineCatalog should be created. Calling this method will not have any effect in video downloads.
-