public abstract class AbstractOfflineCatalog extends Catalog
DEFAULT_EDGE_BASE_URL
eventEmitter, listenerTokens
Constructor and Description |
---|
AbstractOfflineCatalog(android.content.Context context,
EventEmitter eventEmitter,
java.lang.String account,
java.lang.String policy,
java.lang.String baseURL) |
Modifier and Type | Method and Description |
---|---|
void |
addDownloadEventListener(MediaDownloadable.DownloadEventListener downloadEventListener)
Adds the specified to the list of listeners that will be notified when a download event is
raised.
|
boolean |
cancelVideoDownload(java.lang.String videoId)
Cancels a video download that has not been completed yet.
|
boolean |
cancelVideoDownload(Video video)
Cancels a video download that has not been completed yet.
|
boolean |
deleteVideo(java.lang.String videoId)
Deletes the offline copy of the specified video.
|
boolean |
deleteVideo(Video video)
This method can be used to remove all assets related to a single video from the host device.
|
DownloadStatus |
downloadVideo(Video video)
This method is used to request a single video to be downloaded asynchronously for offline playback.
|
long |
estimateSize(Video video)
This method is used to determine the approximate total size of all assets needed to store
the video on the host device.
|
void |
estimateSize(Video video,
MediaDownloadable.OnVideoSizeCallback callback)
Asynchronous call
|
java.util.List<Video> |
findAllQueuedVideoDownload()
This method returns the list of videos that have been queued for download.
|
java.util.List<Video> |
findAllVideoDownload(int status)
Finds all offline video downloads with specified status.
|
Video |
findOfflineVideoById(java.lang.String videoId)
Finds the offline copy of the specified video, if it exists.
|
java.io.File |
getDownloadPath()
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.
|
DownloadStatus |
getVideoDownloadStatus(java.lang.String videoId)
Gets the status of previous video download request.
|
DownloadStatus |
getVideoDownloadStatus(Video video)
Gets the status of previous video download request.
|
boolean |
isMeteredDownloadAllowed()
Returns whether download over a metered network is allowed.
|
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.
|
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.
|
int |
pauseVideoDownload(java.lang.String videoId)
This method is used to pause a single video being downloaded.
|
int |
pauseVideoDownload(Video video)
This method is used to 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 |
renewLicense(Video video,
EventListener listener)
Deprecated.
The renewLicense method is deprecated and is now non-functional.
To renew an offline license, please use either
requestRentalLicense(Video, Date, long, EventListener) or
requestPurchaseLicense(Video, EventListener) . |
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 |
requestRentalLicense(Video video,
java.util.Date absoluteExpiration,
long playDuration,
EventListener listener)
Submits an offline playback rental license request for the specified video asynchronously.
|
void |
requestRentalLicense(Video video,
java.util.Date absoluteExpiration,
long playDuration,
EventListener listener,
CustomerRightsTokenConfig config)
Submits an offline playback rental license request for the specified video asynchronously.
|
int |
resumeVideoDownload(java.lang.String videoId)
This method is used to resume a single video being downloaded which was previously paused.
|
int |
resumeVideoDownload(Video video)
This method is used to resume a single video being downloaded which was previously paused.
|
void |
setDownloadPath(java.io.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.
|
findPlaylistByID, findPlaylistByID, findPlaylistByID, findPlaylistByReferenceID, findPlaylistByReferenceID, findPlaylistByReferenceID, findVideoByID, findVideoByID, findVideoByID, findVideoByReferenceID, findVideoByReferenceID, findVideoByReferenceID
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
public AbstractOfflineCatalog(android.content.Context context, EventEmitter eventEmitter, java.lang.String account, java.lang.String policy, java.lang.String baseURL)
@NonNull public java.io.File getDownloadPath()
public void setDownloadPath(@Nullable java.io.File downloadPath)
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 automatically
Though 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.
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.java.lang.IllegalArgumentException
- if the download path is invalid or if the download path does
not have read or write permissions.RequestConfig.setDownloadPath(File)
public boolean isMobileDownloadAllowed()
By default the SDK will not use a cellular network. This setting must be enabled explicitly by the developer.
public void setMobileDownloadAllowed(boolean mobileDownloadAllowed)
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.
mobileDownloadAllowed
- true if cellular network is allowed.public boolean isRoamingDownloadAllowed()
By default the SDK will not use cellular roaming network. This setting must be enabled explicitly by the developer.
public void setRoamingDownloadAllowed(boolean roamingDownloadAllowed)
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.
roamingDownloadAllowed
- true if roaming is allowed.public boolean isMeteredDownloadAllowed()
setMeteredDownloadAllowed(boolean)
public void setMeteredDownloadAllowed(boolean meteredDownloadAllowed)
meteredDownloadAllowed
- whether metered is allowedpublic void setVideoBitrate(int videoBitrate)
videoBitrate
- the video bitratepublic void addDownloadEventListener(@NonNull MediaDownloadable.DownloadEventListener downloadEventListener)
downloadEventListener
- the download event listenerMediaDownloadable.DownloadEventListener
public void removeDownloadEventListener(@NonNull MediaDownloadable.DownloadEventListener downloadEventListener)
downloadEventListener
- the download event listenerMediaDownloadable.DownloadEventListener
public long estimateSize(Video video)
video
- - reference to the video to be estimated.public void estimateSize(Video video, MediaDownloadable.OnVideoSizeCallback callback)
video
- callback
- public void getMediaFormatTracksAvailable(@NonNull Video video, @NonNull MediaDownloadable.MediaFormatListener mediaFormatListener)
MediaDownloadable.MediaFormatListener
listener.
Note: Only the video type DeliveryType.DASH
is currently supported.
video
- mediaFormatListener
- public DownloadStatus downloadVideo(@NonNull Video video)
Please register a MediaDownloadable.DownloadEventListener
to receive notifications
when the download is completed, cancelled or failed.
video
- to be downloaded.java.lang.IllegalStateException
- If the video has been already queued for download.public boolean cancelVideoDownload(@NonNull Video video)
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.
video
- the video to be cancelled.public boolean cancelVideoDownload(@NonNull java.lang.String videoId)
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.
videoId
- the video id.public int pauseVideoDownload(Video video)
video
- the video to be paused.java.lang.UnsupportedOperationException
- if the underlying download process does not support
pausing video downloads.public int pauseVideoDownload(@NonNull java.lang.String videoId)
videoId
- the video id.java.lang.UnsupportedOperationException
- if the underlying download process does not support
pausing video downloads.public int resumeVideoDownload(@NonNull Video video)
video
- the video to be paused.java.lang.UnsupportedOperationException
- if the underlying download process does not support
pausing video downloads.public int resumeVideoDownload(@NonNull java.lang.String videoId)
videoId
- the video id.java.lang.UnsupportedOperationException
- if the underlying download process does not support
pausing video downloads.public boolean deleteVideo(@NonNull Video video)
releaseLicense(Video, EventListener)
to release and remove the license.video
- to be deleted.public boolean deleteVideo(@NonNull java.lang.String videoId)
releaseLicense(Video, EventListener)
or saving the license key set identifier for
future reuse.videoId
- the unique identified of the video to be deleted.public DownloadStatus getVideoDownloadStatus(@NonNull Video video)
video
- the video being downloaded.@NonNull public DownloadStatus getVideoDownloadStatus(@NonNull java.lang.String videoId)
videoId
- the video id.@NonNull public java.util.List<Video> findAllQueuedVideoDownload()
getVideoDownloadStatus(Video)
to find the current download status of each video.@NonNull public java.util.List<Video> findAllVideoDownload(int status)
status
- the status of the video download.@Nullable public Video findOfflineVideoById(java.lang.String videoId)
getVideoDownloadStatus(Video)
method to determine the current status of the offline copy.videoId
- the video id.public void requestRentalLicense(@NonNull Video video, @NonNull java.util.Date absoluteExpiration, long playDuration, @NonNull EventListener listener)
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.public void requestRentalLicense(@NonNull Video video, @NonNull java.util.Date absoluteExpiration, long playDuration, @NonNull EventListener listener, @NonNull CustomerRightsTokenConfig config)
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 requestpublic void requestPurchaseLicense(@NonNull Video video, @NonNull EventListener listener)
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.public void requestPurchaseLicense(@NonNull Video video, @NonNull EventListener listener, @NonNull CustomerRightsTokenConfig config)
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@Deprecated public void renewLicense(@NonNull Video video, @NonNull EventListener listener)
requestRentalLicense(Video, Date, long, EventListener)
or
requestPurchaseLicense(Video, EventListener)
.public void releaseLicense(@NonNull Video video, @NonNull EventListener listener)
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.