BMPOfflineManager

Objective-C


@interface BMPOfflineManager : NSObject

Swift

class OfflineManager : NSObject

IMPORTANT: Methods from BMPOfflineManager need to be called from the main thread.

Do not create own instances of this class, instead use [OfflineManager sharedInstance] to obtain a reference to the singleton.

  • Value in megabytes for minimum system free space available before suspending active downloads. Default value is 500Mb.

    Declaration

    Objective-C

    @property (class, nonatomic) NSUInteger minimumAvailableSpaceThreshold;

    Swift

    class var minimumAvailableSpaceThreshold: UInt { get set }
  • Indicates if the OfflineManager is initialized.

    Declaration

    Objective-C

    @property (class, readonly) BOOL isOfflineManagerInitialized;

    Swift

    class var isOfflineManagerInitialized: Bool { get }
  • Specifies if an active WiFi connection is required for downloading media for offline playback. Default is NO.

    Declaration

    Objective-C

    @property (nonatomic) BOOL restrictMediaDownloadsToWiFi;

    Swift

    var restrictMediaDownloadsToWiFi: Bool { get set }
  • Indicates if the OfflineManager has finished restoring suspended downloads.

    Warning

    Any resume or cancel actions triggered before this returns true are not guaranteed and might result in unexpected behaviour.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL areSuspendedDownloadsRestored;

    Swift

    var areSuspendedDownloadsRestored: Bool { get }
  • The delegate for the OfflineManager

    Declaration

    Objective-C

    @property (nonatomic, weak) id<BMPOfflineManagerDelegate> _Nullable delegate;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    + (instancetype)new NS_UNAVAILABLE;
  • Declaration

    Objective-C

    + (nonnull instancetype)sharedInstance;

    Swift

    class func sharedInstance() -> Self

    Return Value

    The singleton instance of the BMPOfflineManager.

  • 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

    Objective-C

    + (void)initializeOfflineManager;

    Swift

    class 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

    Objective-C

    + (void)initializeOfflineManagerWithOfflineConfig:
        (nonnull BMPOfflineConfig *)offlineConfig;

    Swift

    class func initializeOfflineManager(offlineConfig: BMPOfflineConfig)

    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 (or return nil in ObjC) 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.

    Declaration

    Objective-C

    - (nullable id<BMPOfflineContentManager>)
        offlineContentManagerForSourceConfig:(nonnull BMPSourceConfig *)sourceConfig
                                       error:(NSError *_Nullable *_Nullable)error;

    Parameters

    sourceConfig

    A SourceConfig for which the OfflineContentManger is requested.

    Return Value

    OfflineContentManager instance for the provided SourceConfig @throws an error if the provided SourceConfig is not supported.

  • 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 (or return nil in ObjC) 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.

    Warning

    If an OfflineContentManager is acquired using this method, subsequent calls to any content related API on the OfflineManager are not supported, meaning they could result in unexpected behaviour.

    Declaration

    Objective-C

    - (nullable id<BMPOfflineContentManager>)
        offlineContentManagerForSourceConfig:(nonnull BMPSourceConfig *)sourceConfig
                                  identifier:(nonnull NSString *)identifier
                                       error:(NSError *_Nullable *_Nullable)error;

    Parameters

    sourceConfig

    A SourceConfig for which the OfflineContentManger is requested.

    identifier

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

    Return Value

    OfflineContentManager instance for the provided SourceConfig @throws an error if the provided SourceConfig is not supported.

  • Should be called from your AppDelegate when application(application:handleEventsForBackgroundURLSession:completionHandler:) is called by the system.

    Declaration

    Objective-C

    - (void)addCompletionHandler:(nonnull void (^)(void))completionHandler
                   forIdentifier:(nonnull NSString *)identifier;

    Swift

    func add(completionHandler: @escaping () -> Void, for identifier: String)

    Parameters

    completionHandler

    The completion handler which is provided by the system.

    identifier

    The identifier which is provided by the system.