OfflineManagerListener
@objc(BMPOfflineManagerListener)
public protocol OfflineManagerListener : NSObjectProtocol
Protocol for listeners for the OfflineManager.
-
Is called when the download of the media content failed. Downloaded content may have been stored to disk. It is possible to retry the download by first checking the state of the source config using
OfflineManager.offlineState(for:)and then taking one of the actions allowed in the current state as documented in OfflineManager.hDeclaration
Swift
@objc optional func offlineManager(_ offlineManager: OfflineManager, didFailWithError error: Error?)Parameters
offlineManagerThe
OfflineManagercalling the listener.errorAn optional error object describing the cause of the failure.
-
Is called when the download of the media content was successful.
Declaration
Swift
@objc optional func offlineManagerDidFinishDownload(_ offlineManager: OfflineManager)Parameters
offlineManagerThe
OfflineManagercalling the listener. -
Is called when the download of the media content progressed to a new percentage value. The method is only called when the according SourceConfig is in state OfflineStateDownloading.
Declaration
Swift
@objc optional func offlineManager(_ offlineManager: OfflineManager, didProgressTo progress: Double)Parameters
offlineManagerThe
OfflineManagercalling the listener.progressThe percentage of completion for the current download task.
-
Is called when the download of the media content was suspended. This could be the result of a call to
OfflineManager.suspendDownload(for:)or if the app was terminated by the user while downloads were running. In the latter case, this listener method is called upon first application startup after termination.Declaration
Swift
@objc optional func offlineManagerDidSuspendDownload(_ offlineManager: OfflineManager)Parameters
offlineManagerThe
OfflineManagercalling the listener. -
Is called when the download of the media content was resumed after it was suspended.
Declaration
Swift
@objc optional func offlineManager(_ offlineManager: OfflineManager, didResumeDownloadWithProgress progress: Double)Parameters
offlineManagerThe
OfflineManagercalling the listener.progressThe percentage of completion for the current download task.
-
Is called when the download of the media content was cancelled by the user and all partially downloaded content has been deleted from disk.
Declaration
Swift
@objc optional func offlineManagerDidCancelDownload(_ offlineManager: OfflineManager)Parameters
offlineManagerThe
OfflineManagercalling the listener. -
Is called when the offline license was successfully renewed and written to disk.
Declaration
Swift
@objc optional func offlineManagerDidRenewOfflineLicense(_ offlineManager: OfflineManager)Parameters
offlineManagerThe
OfflineManagercalling the listener. -
Is called under following circumstances if and only if the offline DRM license has expired:
- The
OfflineManagerfirst access a DRM protected SourceConfig. - On every call to
OfflineManager.createOfflineSourceConfig(for:restrictedToAssetCache:)if it is DRM protected.
NOTE: This method is only available starting with iOS 11.0
Declaration
Swift
@available(iOS 11.0, *) @objc optional func offlineManagerOfflineLicenseDidExpire(_ offlineManager: OfflineManager)Parameters
offlineManagerThe
OfflineManagercalling the listener. - The
-
Is called when information on available tracks is available.
Declaration
Swift
@objc optional func offlineManager( _ offlineManager: OfflineManager, didFetchAvailableTracks tracks: OfflineTrackSelection )Parameters
offlineManagerThe
OfflineManagercalling the listener.tracksThe available OfflineTrackSelection.
OfflineManagerListener Protocol Reference