Shaka Player Embedded
ShakaPlayerStorage.h
Go to the documentation of this file.
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_SHAKA_PLAYER_STORAGE_H_
16 #define SHAKA_EMBEDDED_SHAKA_PLAYER_STORAGE_H_
17 
18 #import <Foundation/Foundation.h>
19 
20 #include "macros.h"
21 #include "offline_externs_objc.h"
22 #include "ShakaPlayer.h"
23 
24 
25 NS_ASSUME_NONNULL_BEGIN
26 
31 @protocol ShakaPlayerStorageClient <NSObject>
32 
33 @optional
34 
38 - (void)onStorageProgress:(double)progress
39  withContent:(ShakaStoredContent *)content;
40 
41 @end
42 
49 @interface ShakaPlayerStorage : NSObject
50 
51 - (nullable instancetype)initWithError:(NSError * _Nullable __autoreleasing * _Nullable)error NS_SWIFT_NAME(init());
52 - (nullable instancetype)initWithPlayer:(ShakaPlayer * _Nullable) player
53  andError:(NSError * _Nullable __autoreleasing * _Nullable)error NS_SWIFT_NAME(init(player:));
54 
56 @property(atomic, weak, nullable) id<ShakaPlayerStorageClient> client;
57 
59 @property(atomic, readonly) BOOL storeInProgress;
60 
65 - (void)destroyWithBlock:(ShakaPlayerAsyncBlock) block;
66 
73 - (void)listWithBlock:(void (^)(NSArray<ShakaStoredContent *> *,
74  ShakaPlayerError * _Nullable)) block;
75 
80 - (void)remove:(NSString *)content_uri withBlock:(ShakaPlayerAsyncBlock) block;
81 
86 - (void)removeEmeSessionsWithBlock:(void (^)(BOOL, ShakaPlayerError * _Nullable)) block;
87 
93 - (void) store:(NSString*)uri
94  withBlock:(void (^)(ShakaStoredContent *, ShakaPlayerError * _Nullable)) block;
95 
100 - (void)store:(NSString *)uri
101  withAppMetadata:(NSDictionary<NSString *, NSString *> *)data
102  andBlock:(void (^)(ShakaStoredContent *, ShakaPlayerError * _Nullable))block;
103 
104 
113 - (void)configure:(const NSString *)namePath withBool:(BOOL)value;
114 
123 - (void)configure:(const NSString *)namePath withDouble:(double)value;
124 
133 - (void)configure:(const NSString *)namePath withString:(const NSString *)value;
134 
142 - (void)configureWithDefault:(const NSString *)namePath;
143 
144 @end
145 
146 NS_ASSUME_NONNULL_END
147 #endif // SHAKA_EMBEDDED_SHAKA_PLAYER_STORAGE_H_
#define SHAKA_EXPORT
Definition: macros.h:30
void(^ ShakaPlayerAsyncBlock)(ShakaPlayerError *_Nullable)
Definition: ShakaPlayer.h:36
id< ShakaPlayerStorageClient > client