OODtoAsset.h
1 //
2 // OODtoAsset.h
3 // OoyalaSDK
4 //
5 // Created on 10/9/18.
6 // Copyright © 2018 Brightcove, Inc. All rights reserved.
7 //
8 
9 @import AVFoundation;
10 @class AVURLAsset;
11 @class AVMediaSelection;
14 @class OOOoyalaError;
15 @class OOVideo;
16 @class OOOfflineVideo;
17 
18 typedef void (^ProgressParameter)(double progress);
19 typedef void (^FinishParameter)(NSString * _Nonnull relativePath);
20 typedef void (^ErrorParameter)(OOOoyalaError * _Nullable error);
21 
22 typedef NS_ENUM(NSInteger, OODtoAssetState) {
23  OODtoAssetStateNotDownloaded,
24  OODtoAssetStateAuthorizing,
25  OODtoAssetStateDownloading,
26  OODtoAssetStatePaused,
27  OODtoAssetStateDownloaded
28 };
29 
30 NS_CLASS_AVAILABLE_IOS(10.0)
38 @interface OODtoAsset : NSObject
39 
44 @property (nonatomic, readonly, nonnull) NSString *embedCode;
48 @property (nonatomic, readonly, nullable) NSString *name;
52 @property (nonatomic, readonly, nonnull) OOAssetDownloadOptions *options;
53 
54 @property (nonatomic, nonnull) AVURLAsset *urlAsset;
55 
59 @property (nonatomic, nullable) AVMediaSelection *mediaSelection;
60 
61 @property (nonatomic, nullable) NSString *currentDownload;
62 
66 @property (nonatomic, readonly, nullable) NSURL *localUrl;
70 @property (nonatomic, readonly, nullable) NSURL *fairplayKey;
71 
75 @property (nonatomic, readonly) OODtoAssetState state;
79 @property (nonatomic, readonly, nonnull) NSString *stateText;
80 
84 @property (nonatomic, readonly, nullable) OOOfflineVideo *offlineVideo;
85 
86 @property ProgressParameter _Nullable progressClosure;
87 @property FinishParameter _Nullable finishClosure;
88 @property ErrorParameter _Nullable errorClosure;
89 
93 @property BOOL success;
97 @property OOOoyalaError * _Nullable error;
98 
99 - (nonnull instancetype)init NS_UNAVAILABLE;
100 
108 - (nonnull instancetype)initWithOptions:(nonnull OOAssetDownloadOptions *)options
109  andName:(nonnull NSString *)name NS_DESIGNATED_INITIALIZER;
110 
116 - (void)downloadWithProgressClosure:(nullable ProgressParameter)closure;
117 
123 - (void)progressWithProgressClosure:(nonnull ProgressParameter)closure;
124 
130 - (void)finishWithRelativePath:(nonnull FinishParameter)closure;
131 
137 - (void)onErrorWithErrorClosure:(nonnull ErrorParameter)closure;
138 
142 - (void)cancelDownload;
143 
147 - (void)deleteAsset;
148 
152 - (void)pauseDownload;
153 
157 - (void)resumeDownload;
158 
164 - (void)getStreamsWithCallback:(void (^_Nullable)(NSArray<OOAssetDownloadStream *> * _Nullable streams))callback;
165 
166 @end
Definition: OOAssetDownloadStream.h:10
void deleteAsset()
Deletes the asset.
Definition: OOOfflineVideo.h:11
void resumeDownload()
Resumes the download of the asset.
OODtoAssetState state
State of the asset.
Definition: OODtoAsset.h:75
OOAssetDownloadOptions * options
OOAssetDownloadOptions set for a specific asset.
Definition: OODtoAsset.h:52
ErrorParameter _Nullable errorClosure
Definition: OODtoAsset.h:88
void cancelDownload()
Cancels a download of the asset.
NSURL * fairplayKey
NSURL pointing to a local resource with the Fairplay key.
Definition: OODtoAsset.h:70
NSString * stateText
String text of the asset&#39;s state.
Definition: OODtoAsset.h:79
void pauseDownload()
Pauses the download of the asset.
BOOL success
Flag indicating if download was successful.
Definition: OODtoAsset.h:93
AVMediaSelection * mediaSelection
AVMediaSelection set for a specific asset (e.g.
Definition: OODtoAsset.h:59
NSString * name
Human readable asset name displayed in UI.
Definition: OODtoAsset.h:48
NSString * embedCode
Embed code managed by this OODtoAsset instance.
Definition: OODtoAsset.h:44
Represents an error in the Ooyala SDK.
Definition: OOOoyalaError.h:56
Options object used to create an OODtoAsset.
Definition: OOAssetDownloadOptions.h:32
AVURLAsset * urlAsset
Definition: OODtoAsset.h:54
OOOfflineVideo * offlineVideo
An instance of OOOfflineVideo for the specific asset if downloaded.
Definition: OODtoAsset.h:84
NSString * currentDownload
Definition: OODtoAsset.h:61
NSURL * localUrl
NSURL pointing to a local resource with the downloaded asset.
Definition: OODtoAsset.h:66
ProgressParameter _Nullable progressClosure
Definition: OODtoAsset.h:86
nonnull instancetype NS_UNAVAILABLE()
OOOoyalaError *_Nullable error
Error if exists.
Definition: OODtoAsset.h:97
FinishParameter _Nullable finishClosure
Definition: OODtoAsset.h:87
Use this class to manage an offline-downloadable asset.
Definition: OODtoAsset.h:38
this class implements video stream object
Definition: OOVideo.h:22