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 or cancel actions triggered before this returns true 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‘s application(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‘s application(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
  • Returns an OfflineContentManager instance which can be used to manage offline content and offline DRM related tasks for the provided SourceConfig.

    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. A SourceConfig is only valid for download when it’s configured using an HLS asset.

    It is possible to update parts of the SourceConfig between calls if no download or license related task is in progress. E.g it is possible to update the FairPlayConfig for a subsequent download attempt.

    Declaration

    Swift

    @objc(offlineContentManagerForSourceConfig:error:)
    public func offlineContentManager(for sourceConfig: SourceConfig) throws -> OfflineContentManager

    Parameters

    sourceConfig

    A SourceConfig for which the OfflineContentManger is requested.

    Return Value

    OfflineContentManager instance for the provided SourceConfig

  • Returns an OfflineContentManager instance which can be used to manage offline content and offline DRM related tasks for the provided SourceConfig.

    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. A SourceConfig is only valid for download when it’s configured using an HLS asset.

    It is possible to update parts of the SourceConfig between calls if no download or license related task is in progress. E.g it is possible to update the FairPlayConfig for a subsequent download attempt.

    Declaration

    Swift

    @objc(offlineContentManagerForSourceConfig:identifier:error:)
    public func offlineContentManager(
        for sourceConfig: SourceConfig,
        id identifier: String
    ) throws -> OfflineContentManager

    Parameters

    for

    A SourceConfig for which the OfflineContentManger is requested.

    id

    A unique identifier for the given SourceConfig which must not change once provided.

    Return Value

    OfflineContentManagerinstance for the providedSourceConfig`

  • Has to be called in your AppDelegate‘s application(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.