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
OfflineManagerhas finished restoring suspended downloads.Warning
Anyresumeorcancelactions triggered before this returnstrueare 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
OfflineManagerDeclaration
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() -> SelfReturn 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
offlineConfigThe
OfflineConfig -
Returns an
OfflineContentManagerinstance 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 (or return
nilin ObjC) in case aSourceConfigis passed that is not supported for being downloaded. ASourceConfigis 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
sourceConfigA
SourceConfigfor which theOfflineContentMangeris requested.Return Value
OfflineContentManagerinstance for the providedSourceConfig@throws an error if the providedSourceConfigis not supported. -
Returns an
OfflineContentManagerinstance which can be used to manage offline content and offline DRM related tasks for the providedSourceConfig.The provided
identifierwill 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
nilin ObjC) in case aSourceConfigis passed that is not supported for being downloaded. ASourceConfigis only valid for download when it’s configured using an HLS asset.Warning
If anOfflineContentManageris acquired using this method, subsequent calls to any content related API on theOfflineManagerare 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
sourceConfigA
SourceConfigfor which theOfflineContentMangeris requested.identifierA unique identifier for the given
SourceConfigwhich must not change once provided.Return Value
OfflineContentManagerinstance for the providedSourceConfig@throws an error if the providedSourceConfigis 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
completionHandlerThe completion handler which is provided by the system.
identifierThe identifier which is provided by the system.
BMPOfflineManager Class Reference