/
BCOVDAIComponent.h
233 lines (197 loc) · 11.3 KB
/
BCOVDAIComponent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
//
// BCOVDAIComponent.h
// BrightcoveDAI
//
// Copyright (c) 2024 Brightcove, Inc. All rights reserved.
// License: https://accounts.brightcove.com/en/terms-and-conditions
//
#import <Foundation/Foundation.h>
#import <BrightcovePlayerSDK/BrightcovePlayerSDK.h>
@class BCOVDAIAdsRequestPolicy;
@class IMAAdsRenderingSettings, IMASettings, IMAStreamRequest;
NS_ASSUME_NONNULL_BEGIN
/**
* When DAI ads load successfully, the kBCOVIMALifecycleEventAdsLoaderLoaded
* lifecycle event "properties" dictionary contains a reference to the IMAAdsLoader
* which can be retrieved using the key kBCOVIMALifecycleEventPropertyKeyAdsManager.
*/
extern NSString * const kBCOVDAILifecycleEventAdsLoaderLoaded;
extern NSString * const kBCOVDAILifecycleEventAdsLoaderFailed;
extern NSString * const kBCOVDAILifecycleEventAdsManagerDidReceiveAdEvent;
extern NSString * const kBCOVDAILifecycleEventAdsManagerDidReceiveAdError;
extern NSString * const kBCOVDAILifecycleEventPropertyKeyAdsManager;
extern NSString * const kBCOVDAILifecycleEventPropertyKeyAdEvent;
extern NSString * const kBCOVDAILifecycleEventPropertyKeyAdError;
extern NSString * const kBCOVDAIAdPropertiesKeyIMAAdInstance;
/**
* The dictionary key in the video properties for the VOD content source ID.
*/
extern NSString * const kBCOVDAIVideoPropertiesKeySourceId;
/**
* The dictionary key in the video properties for the VOD video ID.
*/
extern NSString * const kBCOVDAIVideoPropertiesKeyVideoId;
/**
* The dictionary key in the video properties for the LIVE stream asset key.
*/
extern NSString * const kBCOVDAIVideoPropertiesKeyAssetKey;
/**
* The dictionary key in the video properties for the
* IMA ad display container (IMAAdDisplayContainer *) associated with this ad.
*/
extern NSString * const kBCOVDAIVideoPropertiesKeyAdDisplayContainer;
extern NSString * const kBCOVDAIOptionDAIPlaybackSessionDelegateKey;
/**
* Category methods added to BCOVPlayerSDKManager to support DAI.
*/
@interface BCOVPlayerSDKManager (BCOVDAIAdditions)
/**
* Creates and returns a new playback controller with the specified IMASettings
* object, IMAAdsRenderingSettings object, view strategy, and ad container. The
* returned playback controller will be configured with a DAI session provider.
*
* @param settings An IMASettings that will be used to configure any
* IMAAdsLoader object used by the returned playback controller.
* @param adsRenderingSettings An IMAAdsRenderingSettings that will be used to
* configure any IMAAdsManager object used by the returned playback controller.
* @param adsRequestPolicy BCOVDAIAdsRequestPolicy instance to generate
* IMAStreamRequests for use by a given input playback session.
* @param strategy A view strategy that determines the view for the returned
* playback controller.
* @param adContainer the view in which the ad will be displayed and the ad
* information UI will be rendered.
* @param adContainerViewController The view controller containing the ad container. If not provided
* here, must be set on the IMAAdDisplayContainer before making an ads or stream request.
* @param companionSlots the list of IMACompanionAdSlot instances. Can be nil
* or empty.
* @return A new playback controller with the specified parameters.
*/
- (id<BCOVPlaybackController>)createDAIPlaybackControllerWithSettings:(nullable IMASettings *)settings
adsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(nullable BCOVDAIAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(nullable NSArray *)companionSlots
viewStrategy:(nullable BCOVPlaybackControllerViewStrategy)strategy;
/**
* Creates and returns a new playback controller with the specified IMASettings
* object, IMAAdsRenderingSettings object, view strategy, and ad container. The
* returned playback controller will be configured with a DAI session provider.
*
* @param settings An IMASettings that will be used to configure any
* IMAAdsLoader object used by the returned playback controller.
* @param adsRenderingSettings An IMAAdsRenderingSettings that will be used to
* configure any IMAAdsManager object used by the returned playback controller.
* @param adsRequestPolicy BCOVDAIAdsRequestPolicy instance to generate
* IMAStreamRequests for use by a given input playback session.
* @param strategy A view strategy that determines the view for the returned
* playback controller.
* @param adContainer the view in which the ad will be displayed and the ad
* information UI will be rendered.
* @param adContainerViewController The view controller containing the ad container. If not provided
* here, must be set on the IMAAdDisplayContainer before making an ads or stream request.
* @param companionSlots the list of IMACompanionAdSlot instances. Can be nil
* or empty.
* @param options An NSDictionary of DAI options. Can be nil or empty. The only
* valid option keys are
* kBCOVDAIOptionDAIPlaybackSessionDelegateKey
* See the "Modifying the IMAStreamRequest" section of the DAI plugin README for more information.
* @return A new playback controller with the specified parameters.
*/
- (id<BCOVPlaybackController>)createDAIPlaybackControllerWithSettings:(nullable IMASettings *)settings
adsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(nullable BCOVDAIAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(nullable NSArray *)companionSlots
viewStrategy:(nullable BCOVPlaybackControllerViewStrategy)strategy
options:(nullable NSDictionary *)options;
/**
* Creates and returns a new BCOVDAISessionProvider with the specified
* parameters.
*
* @param settings An IMASettings that will be used to configure any
* IMAAdsLoader object used by the returned session provider.
* @param adsRenderingSettings An IMAAdsRenderingSettings that will be used to
* configure any IMAAdsManager object used by the returned session provider.
* @param adsRequestPolicy BCOVDAIAdsRequestPolicy instance to generate
* IMAStreamRequests for use by a given input playback session.
* @param adContainer the view in which the ad will be displayed and the ad
* information UI will be rendered.
* @param adContainerViewController The view controller containing the ad container. If not provided
* here, must be set on the IMAAdDisplayContainer before making an ads or stream request.
* @param companionSlots the list of IMACompanionAdSlot instances. Can be nil
* or empty.
* @param provider A session provider to attach upstream and deliver playback
* sessions to the returned session provider.
* @return A new BCOVDAISessionProvider with the specified parameters.
*/
- (id<BCOVPlaybackSessionProvider>)createDAISessionProviderWithSettings:(nullable IMASettings *)settings
adsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(nullable BCOVDAIAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(nullable NSArray *)companionSlots
upstreamSessionProvider:(nullable id<BCOVPlaybackSessionProvider>)provider;
/**
* Creates and returns a new BCOVDAISessionProvider with the specified
* parameters.
*
* @param settings An IMASettings that will be used to configure any
* IMAAdsLoader object used by the returned session provider.
* @param adsRenderingSettings An IMAAdsRenderingSettings that will be used to
* configure any IMAAdsManager object used by the returned session provider.
* @param adsRequestPolicy BCOVDAIAdsRequestPolicy instance to generate
* IMAStreamRequests for use by a given input playback session.
* @param adContainer the view in which the ad will be displayed and the ad
* information UI will be rendered.
* @param adContainerViewController The view controller containing the ad container. If not provided
* here, must be set on the IMAAdDisplayContainer before making an ads or stream request.
* @param companionSlots the list of IMACompanionAdSlot instances. Can be nil
* or empty.
* @param provider A session provider to attach upstream and deliver playback
* sessions to the returned session provider.
* @param options An NSDictionary of DAI options. Can be nil or empty. The only
* valid option keys are
* kBCOVDAIOptionDAIPlaybackSessionDelegateKey
* See the "Modifying the IMAStreamRequest" section of the DAI plugin README for more information.
* @return A new BCOVDAISessionProvider with the specified parameters.
*/
- (id<BCOVPlaybackSessionProvider>)createDAISessionProviderWithSettings:(nullable IMASettings *)settings
adsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(nullable BCOVDAIAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(nullable NSArray *)companionSlots
upstreamSessionProvider:(nullable id<BCOVPlaybackSessionProvider>)provider
options:(nullable NSDictionary *)options;
@end
/**
* A delegate protocol for users of the Brightcove DAI advertising plugin.
*/
@protocol BCOVDAIPlaybackSessionDelegate
@optional
/**
* Called immediately before the DAI Plugin calls IMAAdsLoader -requestAdsWithRequest:
* to allow the user to first modify the ads request object, for example, to change
* the vastLoadTimeout property. This method is optional.
*/
- (void)willCallIMAAdsLoaderRequestAdsWithRequest:(IMAStreamRequest *)adsRequest;
@end
@interface BCOVDAIComponent : NSObject <BCOVComponent, BCOVComponentIdentity>
+ (NSString *)versionIdentifier;
@end
@interface BCOVSessionProviderExtension (BCOVDAIAdditions)
/**
* Plays the video.
*
* On first play, before playing content, the session will process all preroll ads before starting
* the content.
*/
- (void)dai_play;
/**
* Pauses the video.
*/
- (void)dai_pause;
@end
NS_ASSUME_NONNULL_END