BCOVOfflineVideoManagerDelegate Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | BCOVOfflineVideoManagerDelegate.h |
– didCreateSharedBackgroundSesssionConfiguration:
This method is called after the background NSURLSessionConfiguration object is created, and before it’s used to create the shared AVAssetDownloadURLSession object that’s used to download videos.
- (void)didCreateSharedBackgroundSesssionConfiguration:(NSURLSessionConfiguration *)backgroundSessionConfiguration
Discussion
You can use this configuration object to set various options specified for the
NSURLSessionConfiguration in NSURLSession.h, such as the discretionary
flag, or
the HTTPMaximumConnectionsPerHost
setting.
You should not set the allowsCellularAccess
property; that is set in the individual
download tasks.
Declared In
BCOVOfflineVideoManagerDelegate.h
– offlineVideoToken:aggregateDownloadTask:didProgressTo:forMediaSelection:
Receive progress notification about track downloads in progress for a downloaded video.
- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken aggregateDownloadTask:(AVAggregateAssetDownloadTask *)aggregateDownloadTask didProgressTo:(NSTimeInterval)progressPercent forMediaSelection:(AVMediaSelection *)mediaSelection
Parameters
offlineVideoToken |
Offline video token used to identify the downloaded video. |
---|---|
aggregateDownloadTask |
The AVAggregateAssetDownloadTask for this set of video track downloads |
progressPercent |
How far along the download has progressed, expressed as a percentage, for this individual AVMediaSelection. |
mediaSelection |
The AVMediaSelection for which this progress is reported. |
Discussion
If you want to pause/resume/cancel the task, you should use the methods available in the BCOVOfflineVideoManager to perform those actions.
Declared In
BCOVOfflineVideoManagerDelegate.h
– offlineVideoToken:assetDownloadTask:didProgressTo:
Receive progress notification about track downloads in progress for a downloaded video.
- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken assetDownloadTask:(AVAssetDownloadTask *)assetDownloadTask didProgressTo:(NSTimeInterval)progressPercent
Parameters
offlineVideoToken |
Offline video token used to identify the downloaded video. |
---|---|
assetDownloadTask |
The AVAssetDownloadTask for this set of video track downloads |
progressPercent |
How far along the download has progressed, expressed as a percentage, for this individual AVMediaSelection. |
Discussion
If you want to pause/resume/cancel the task, you should use the methods available in the BCOVOfflineVideoManager to perform those actions. This delegate method will called when downloading with an AVAssetDownloadConfiguration.
Declared In
BCOVOfflineVideoManagerDelegate.h
– offlineVideoToken:assetDownloadTask:willDownloadVariants:
Receive confirmation of which AVAssetVariants will be downloaded.
- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken assetDownloadTask:(AVAssetDownloadTask *)assetDownloadTask willDownloadVariants:(NSArray<AVAssetVariant*> *)variants
Parameters
offlineVideoToken |
Offline video token used to identify the downloaded video. |
---|---|
assetDownloadTask |
The AVAssetDownloadTask for this set of video track downloads |
variants |
An array of AVAssetVariant objects that will be downloaded. |
Discussion
This delegate method will called when downloading with an AVAssetDownloadConfiguration.
Declared In
BCOVOfflineVideoManagerDelegate.h
– offlineVideoToken:didFinishMediaSelectionDownload:
This method is called when an individual track download is complete.
- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken didFinishMediaSelectionDownload:(AVMediaSelection *)mediaSelection
Parameters
offlineVideoToken |
Offline video token used to identify the offline video for which tracks are being downloaded. |
---|---|
mediaSelection |
The AVMediaSelection that has finished downloading. |
Declared In
BCOVOfflineVideoManagerDelegate.h
– offlineVideoToken:didFinishDownloadWithError:
This method is called when a download is complete.
- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken didFinishDownloadWithError:(NSError *)error
Parameters
offlineVideoToken |
Offline video token used to identify the downloaded video. |
---|---|
error |
NSError encountered during the download process. nil if no error. |
Discussion
If an error occurred during the download, error will be non-nil.
Declared In
BCOVOfflineVideoManagerDelegate.h
– didDownloadStaticImagesWithOfflineVideoToken:
This method is called when the static images (thumbnail and poster) associated with a video are downloaded to storage.
- (void)didDownloadStaticImagesWithOfflineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken
Parameters
offlineVideoToken |
Offline video token used to identify the downloaded video. |
---|
Discussion
File URLs for the downloaded images are stored as properties on a BCOVVideo created from the offline video token using -[videoObjectFromOfflineVideoToken:] The properties are retrieved using the kBCOVOfflineVideoThumbnailFilePath and kBCOVOfflineVideoPosterFilePath keys.
This method will be called even if no images could be retrieved, so be sure to check the UIImage you create from the poster and thumbnail paths. The file paths will be present, but there may be no images stored at those locations.
Declared In
BCOVOfflineVideoManagerDelegate.h
– shouldDeleteVideoPackage:
This method is called when cleaning up stranded downloads.
- (BOOL)shouldDeleteVideoPackage:(NSString *)videoPackagePath
Parameters
videoPackagePath |
Path to video package directory that is flagged as stranded. |
---|
Discussion
Downloads can be stranded if you force-quit an app during a download, or reboot while the app is suspended. You do not need to implement this method unless you are starting your own video downloads outside the Brightcove SDK and don’t want your videos deleted. This method is called when a video package is flagged for deletion, meaning there is no record of it in the Brightcove SDK.
If the file is one you recognize, you should return NO. Otherwise, returning YES will cause the video package to be deleted. If you do not implement this method, stranded downloads will be deleted by default.
Declared In
BCOVOfflineVideoManagerDelegate.h
– offlineVideoStorageDidChange
This method is called when the app is activated and offline video storage changed while the app was not running or was in the background, for example when the user deletes downloaded videos via the device Storage settings in the General settings of the Settings app.
- (void)offlineVideoStorageDidChange
Discussion
When called, you should update your UI to reflect the changes in offline storage.
Detecting changes to offline video storage occurs whenever the app becomes active.
This method is called on the main thread.
Declared In
BCOVOfflineVideoManagerDelegate.h
– playbackServiceForManifestURLTTLUpdateForVideo:
Called when the TTL token for the current source’s manifest has expired and needs to be refreshed. You will want to implement this delegate method if you are using a BCOVPlaybackService with a custom URL.
- (BCOVPlaybackService *)playbackServiceForManifestURLTTLUpdateForVideo:(BCOVVideo *)video
Parameters
video |
The video that requires a TTL token refresh. |
---|
Return Value
An instance of BCOVPlaybackService that will be used to update the manifest TTL token.
Discussion
Called when the TTL token for the current source’s manifest has expired and needs to be refreshed. You will want to implement this delegate method if you are using a BCOVPlaybackService with a custom URL.
If you are using the default initilaizer for BCOVPlaybackService, initWithAccountId:policyKey:
you do not need to implement this delegate method.
If you return nil
, or do not implement this method, an instance of BCOVPlaybackService will be
created internally with the initWithAccountId:policyKey:
initializer.
Declared In
BCOVOfflineVideoManagerDelegate.h