BCOVOfflineVideoManagerDelegate Protocol Reference

Conforms to NSObject
Declared in BCOVOfflineVideoManager.h

Overview

Conform to this protocol to receive information about each video and video track download.

– offlineVideoToken:downloadTask:didProgressTo:

Receive progress notification about a download in progress. You can use the AVAssetDownloadTask to retrieve more information about the download, like the specific segments that are loaded. If you want to pause/resume/cancel the task, you should use the methods available in the BCOVOfflineVideoManager to perform those actions.

- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken downloadTask:(AVAssetDownloadTask *)downloadTask didProgressTo:(NSTimeInterval)progressPercent

Discussion

Receive progress notification about a download in progress. You can use the AVAssetDownloadTask to retrieve more information about the download, like the specific segments that are loaded. If you want to pause/resume/cancel the task, you should use the methods available in the BCOVOfflineVideoManager to perform those actions.

@param offlineVideoToken Offline video token used to identify the downloaded video. @param downloadTask The AVAssetDownloadTask for this video @param progressPercent How far along the download has progressed, expressed as a percentage.

Declared In

BCOVOfflineVideoManager.h

– offlineVideoToken:didFinishDownloadWithError:

This method is called when a download is complete. If an error occurred during the download, error will be non-nil.

- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken didFinishDownloadWithError:(NSError *)error

Parameters

error

NSError encountered during the download process. nil if no error.

Discussion

This method is called when a download is complete. If an error occurred during the download, error will be non-nil.

@param offlineVideoToken Offline video token used to identify the downloaded video.

Declared In

BCOVOfflineVideoManager.h

– offlineVideoToken:aggregateDownloadTask:didProgressTo:forMediaSelection:

Receive progress notification about track downloads in progress for a downloaded video. If you want to pause/resume/cancel the task, you should use the methods available in the BCOVOfflineVideoManager to perform those actions.

- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken aggregateDownloadTask:(AVAggregateAssetDownloadTask *)aggregateDownloadTask didProgressTo:(NSTimeInterval)progressPercent forMediaSelection:(AVMediaSelection *)mediaSelection

Discussion

Receive progress notification about track downloads in progress for a downloaded video. If you want to pause/resume/cancel the task, you should use the methods available in the BCOVOfflineVideoManager to perform those actions.

@param offlineVideoToken Offline video token used to identify the downloaded video. @param aggregateDownloadTask The AVAggregateAssetDownloadTask for this set of video track downloads @param progressPercent How far along the download has progressed, expressed as a percentage, for this individual AVMediaSelection. @param mediaSelection The AVMediaSelection for which this progress is reported.

Declared In

BCOVOfflineVideoManager.h

– offlineVideoToken:didFinishMediaSelectionDownload:

This method is called when an individual track download is complete.

- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken didFinishMediaSelectionDownload:(AVMediaSelection *)mediaSelection

Discussion

This method is called when an individual track download is complete.

@param offlineVideoToken Offline video token used to identify the offline video for which tracks are being downloaded. @param mediaSelection The AVMediaSelection that has finished downloading.

Declared In

BCOVOfflineVideoManager.h

– offlineVideoToken:didFinishAggregateDownloadWithError:

This method is called when all requested track downloads are complete for the downloaded video specified by the offline video token. If an error occurred during the download, error will be non-nil.

- (void)offlineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken didFinishAggregateDownloadWithError:(NSError *)error

Parameters

error

NSError encountered during the track download process. nil if no error.

Discussion

This method is called when all requested track downloads are complete for the downloaded video specified by the offline video token. If an error occurred during the download, error will be non-nil.

@param offlineVideoToken Offline video token used to identify the downloaded video.

Declared In

BCOVOfflineVideoManager.h

– didDownloadStaticImagesWithOfflineVideoToken:

This method is called when the static images (thumbnail and poster) associated with a video are downloaded to storage. 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.

- (void)didDownloadStaticImagesWithOfflineVideoToken:(BCOVOfflineVideoToken)offlineVideoToken

Discussion

This method is called when the static images (thumbnail and poster) associated with a video are downloaded to storage. 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.

@param offlineVideoToken Offline video token used to identify the downloaded video.

Declared In

BCOVOfflineVideoManager.h

– shouldDeleteVideoPackage:

This method is called when cleaning up stranded downloads. 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 this is no record of it in the Brightcove SDK. If this is a file 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.

- (BOOL)shouldDeleteVideoPackage:(NSString *)videoPackagePath

Discussion

This method is called when cleaning up stranded downloads. 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 this is no record of it in the Brightcove SDK. If this is a file 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.

@param videoPackagePath Path to video package directory that is flagged as stranded.

Declared In

BCOVOfflineVideoManager.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. 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.

- (void)didCreateSharedBackgroundSesssionConfiguration:(NSURLSessionConfiguration *)backgroundSessionConfiguration

Discussion

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. 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

BCOVOfflineVideoManager.h