OfflineManager
@objcMembers
@objc(BMPOfflineManager)
public class OfflineManager : NSObject
-
Value in megabytes for minimum system free space available before suspending active downloads. Default is
500
.Declaration
Swift
public static var minimumAvailableSpaceThreshold: UInt
-
Indicates if the
OfflineManager
is initialized.Declaration
Swift
public static var isOfflineManagerInitialized: Bool { get }
-
Specifies if an active WiFi connection is required for downloading media for offline playback. Default is
false
.Declaration
Swift
public var restrictMediaDownloadsToWiFi: Bool { get set }
-
Indicates if the
OfflineManager
has finished restoring suspended downloads.Any
resume
orcancel
actions triggered before this returnstrue
are not guaranteed and might result in unexpected behaviour.Declaration
Swift
public private(set) var areSuspendedDownloadsRestored: Bool { get }
-
The delegate for the
OfflineManager
Declaration
Swift
public weak var delegate: OfflineManagerDelegate?
-
The singleton instance of the
OfflineManager
.Declaration
Swift
public static func sharedInstance() -> OfflineManager
-
Has to be called in your
AppDelegate
‘sapplication(application:didFinishLaunchingWithOptions:)
method to initialize handling of offline content.If the shared instance is already initialized, this method will not have any effect.
Declaration
Swift
public static func initializeOfflineManager()
-
Has to be called in your
AppDelegate
‘sapplication(application:didFinishLaunchingWithOptions:)
method to initialize handling of offline content.Initializes the shared instance with a given
OfflineConfig
. If the shared instance is already initialized, this method will not have any effect.Declaration
Swift
public static func initializeOfflineManager(offlineConfig: OfflineConfig)
Parameters
offlineConfig
The
OfflineConfig
-
Returns an
OfflineContentManager
instance which can be used to manage offline content and offline DRM related tasks for the providedSourceConfig
.The instance returned by this method will always be the same for the same
SourceConfig
.This method will throw an error in case a
SourceConfig
is passed that is not supported for being downloaded. ASourceConfig
is only valid for download when it’s configured using an HLS asset.Declaration
Swift
@objc(offlineContentManagerForSourceConfig:error:) public func offlineContentManager(for sourceConfig: SourceConfig) throws -> OfflineContentManager
Parameters
sourceConfig
A
SourceConfig
for which theOfflineContentManger
is requested.Return Value
OfflineContentManager
instance for the providedSourceConfig
-
Returns an
OfflineContentManager
instance which can be used to manage offline content and offline DRM related tasks for the providedSourceConfig
.The provided
identifier
will be used to create a folder containing needed resources for the offline content.The instance returned by this method will always be the same for the same
identifier
.This method will throw an error in case a
SourceConfig
is passed that is not supported for being downloaded. ASourceConfig
is only valid for download when it’s configured using an HLS asset.If an
OfflineContentManager
is acquired using this method, subsequent calls to any content related API on theOfflineManager
are not supported, meaning they could result in unexpected behaviour.Declaration
Swift
@objc(offlineContentManagerForSourceConfig:identifier:error:) public func offlineContentManager( for sourceConfig: SourceConfig, id identifier: String ) throws -> OfflineContentManager
Parameters
for
A
SourceConfig
for which theOfflineContentManger
is requested.id
A unique identifier for the given
SourceConfig
which must not change once provided.Return Value
OfflineContentManager
instance for the provided
SourceConfig` -
Has to be called in your
AppDelegate
‘sapplication(application:didFinishLaunchingWithOptions:)
Needs to be called from the main thread.
Declaration
Swift
@objc(addCompletionHandler:forIdentifier:) public func add(completionHandler: @escaping () -> Void, for identifier: String)
Parameters
completionHandler
The completion handler which is provided by the system.
for
The identifier which is provided by the system.