-
Notifications
You must be signed in to change notification settings - Fork 3
/
BCOVIMAComponent.h
241 lines (212 loc) · 11.9 KB
/
BCOVIMAComponent.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
234
235
236
237
238
239
240
241
//
// BCOVIMAComponent.h
// BrightcoveIMA
//
// 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 BCOVIMAAdsRequestPolicy;
@class IMAAdsRenderingSettings;
@class IMAAdsRequest;
@class IMASettings;
/**
* When IMA 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 kBCOVIMALifecycleEventAdsLoaderLoaded;
extern NSString * const kBCOVIMALifecycleEventPropertyKeyAdsManager;
extern NSString * const kBCOVIMALifecycleEventAdsLoaderFailed;
extern NSString * const kBCOVIMALifecycleEventAdsManagerDidReceiveAdEvent;
extern NSString * const kBCOVIMALifecycleEventPropertyKeyAdEvent;
extern NSString * const kBCOVIMALifecycleEventAdsManagerDidReceiveAdError;
extern NSString * const kBCOVIMALifecycleEventPropertyKeyAdError;
extern NSString * const kBCOVIMALifecycleEventAdsManagerDidRequestContentPause;
extern NSString * const kBCOVIMALifecycleEventAdsManagerDidRequestContentResume;
extern NSString * const kBCOVIMAAdPropertiesKeyIMAAdInstance;
extern NSString * const kBCOVIMAOptionIMAPlaybackSessionDelegateKey;
/**
* The default ad tag policy will look for an entry in each session.video's
* properties with this key and use it as the ad tag for VMAP requests. In
* other words, each video for which ad rules have been configured should have
* this key in its properties, and the value should be the ad tag for the VMAP
* response to use for the rest of the video's ad breaks.
*/
extern NSString * const kBCOVIMAAdTag;
/**
* The cue point type for IMA ad type.
*/
extern NSString * const kBCOVIMACuePointTypeAd;
/**
* The dictionary key in the video properties for the
* IMA ad display container (IMAAdDisplayContainer *) associated with this ad.
* May be present in BCOVVideo objects returned in BCOVPlaybackControllerAdsDelegate
* callbacks (the video object is accessible via the session object).
*/
extern NSString * const kBCOVIMAVideoPropertiesKeyAdDisplayContainer;
/**
* Category methods added to BCOVPlayerSDKManager to support IMA.
*/
@interface BCOVPlayerSDKManager (BCOVIMAAdditions)
/**
* 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 an IMA 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 BCOVIMAAdsRequestPolicy instance to generate
* IMAAdsRequests 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>)createIMAPlaybackControllerWithSettings:(IMASettings *)settings
adsRenderingSettings:(IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(BCOVIMAAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(NSArray *)companionSlots
viewStrategy:(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 an IMA 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 BCOVIMAAdsRequestPolicy instance to generate
* IMAAdsRequests 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 IMA options. Can be nil or empty. The only
* valid option keys are
* kBCOVIMAOptionIMAPlaybackSessionDelegateKey
* See the "Device Ad Targeting" section of the IMA plugin README for more information.
* @return A new playback controller with the specified parameters.
*/
- (id<BCOVPlaybackController>)createIMAPlaybackControllerWithSettings:(IMASettings *)settings
adsRenderingSettings:(IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(BCOVIMAAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(NSArray *)companionSlots
viewStrategy:(BCOVPlaybackControllerViewStrategy)strategy
options:(NSDictionary *)options;
/**
* Creates and returns a new BCOVIMASessionProvider 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 BCOVIMAAdsRequestPolicy instance to generate
* IMAAdsRequests 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 BCOVIMASessionProvider with the specified parameters.
*/
- (id<BCOVPlaybackSessionProvider>)createIMASessionProviderWithSettings:(IMASettings *)settings
adsRenderingSettings:(IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(BCOVIMAAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(NSArray *)companionSlots
upstreamSessionProvider:(id<BCOVPlaybackSessionProvider>)provider;
/**
* Creates and returns a new BCOVIMASessionProvider 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 BCOVIMAAdsRequestPolicy instance to generate
* IMAAdsRequests 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 IMA options. Can be nil or empty. The only
* valid option keys are
* kBCOVIMAOptionIMAPlaybackSessionDelegateKey
* See the "Device Ad Targeting" section of the IMA plugin README for more information.
* @return A new BCOVIMASessionProvider with the specified parameters.
*/
- (id<BCOVPlaybackSessionProvider>)createIMASessionProviderWithSettings:(IMASettings *)settings
adsRenderingSettings:(IMAAdsRenderingSettings *)adsRenderingSettings
adsRequestPolicy:(BCOVIMAAdsRequestPolicy *)adsRequestPolicy
adContainer:(UIView *)adContainer
viewController:(UIViewController *)adContainerViewController
companionSlots:(NSArray *)companionSlots
upstreamSessionProvider:(id<BCOVPlaybackSessionProvider>)provider
options:(NSDictionary *)options;
@end
/**
* A delegate protocol for users of the Brightcove IMA advertising plugin.
*/
@protocol BCOVIMAPlaybackSessionDelegate
@optional
/**
* Called immediately before the IMA 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:(IMAAdsRequest *)adsRequest forPosition:(NSTimeInterval)position;
/**
* Called prior to creating a IMAAdsRequest using an ad tag URL that contains
* SpringServe macros. Use this method to return an `NSDictionary` containing
* values that will replace the SpringServe macros in the ad tag URL.
* See `BCOVSpringServeKeys.h` for available keys.
* The IMA plugin will attempt to fill in values for keys that are not passed in.
*/
- (NSDictionary *)valuesForSpringServeMacroReplacement;
@end
@interface BCOVIMAComponent : NSObject <BCOVComponent, BCOVComponentIdentity>
+ (NSString *)versionIdentifier;
@end
/**
* IMA specific methods for the plugin context.
*/
@interface BCOVSessionProviderExtension (BCOVIMAAdditions)
/**
* Plays the video.
*
* On first play, before playing content, the session will process all preroll ads before starting
* the content.
*/
- (void)ima_play;
/**
* Pauses the video.
*/
- (void)ima_pause;
@end