forked from THEOplayer/react-native-theoplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAd.ts
267 lines (238 loc) · 5.85 KB
/
Ad.ts
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/**
* Represents a VAST creative. It is either a linear or non-linear ad.
*
* @public
*/
import type { AdBreak } from './AdBreak';
import type { CompanionAd } from 'theoplayer';
export interface Ad {
/**
* The source ad server information included in the ad response.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
adSystem: string | undefined;
/**
* The integration of the ad, represented by a value from the following list:
* <br/> - `'theo'`
* <br/> - `'google-ima'`
* <br/> - `'google-dai'`
* <br/> - `'freewheel'`
*
* @defaultValue `'theo'`
*/
integration?: string;
/**
* The type of the ad, represented by a value from the following list:
* <br/> - `'linear'`
* <br/> - `'nonlinear'`
*/
type: string;
/**
* The identifier of the creative.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
id: string | undefined;
/**
* The ready state of the ad.
*/
readyState?: AdReadyState;
/**
* The ad break which the ad is part of.
*
* @remarks
* <br/> - Available for VAST-ads.
*/
adBreak: AdBreak;
/**
* The duration of the ad, in seconds.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
* <br/> - Only available for LinearAd.
*/
duration?: number;
/**
* The width of the ad, in pixels.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
width: number | undefined;
/**
* The height of the ad.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
height: number | undefined;
/**
* The URI of the the ad content.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
resourceURI?: string;
/**
* The website of the advertisement.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
clickThrough: string | undefined;
/**
* List of companions which can be displayed outside the player.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
* <br/> - Only supported for `'theo'` and `'google-dai'`.
*/
companions: CompanionAd[];
/**
* Offset after which the ad break may be skipped, in seconds.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
* <br/> - If the offset is -1, the ad is unskippable.
* <br/> - If the offset is 0, the ad is immediately skippable.
* <br/> - Otherwise it must be a positive number indicating the offset.
*/
skipOffset: number | undefined;
/**
* The identifier of the selected creative for the ad.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
creativeId: string | undefined;
/**
* The list of universal ad ID information of the selected creative for the ad.
*
* @remarks
* <br/> - Only supported for `'theo'` and `'google-ima'`.
*/
universalAdIds: UniversalAdId[];
}
/**
* The ad readiness state, represented by a value from the following list:
* <br/> - `'none'`: The ad not loaded state.
* <br/> - `'ready'`: The ad loaded state.
*
* @remarks
* <br/> - An ad is loaded when the ad resource (e.g. VAST file) is downloaded.
* <br/> - another remark
*
* @public
*/
export type AdReadyState = 'none' | 'ready';
/**
* Represents the information regarding the universal identifier of an ad.
*
* @public
*/
export interface UniversalAdId {
/**
* The registry associated with cataloging the UniversalAdId of the selected creative for the ad.
*
* @remarks
* <br/> - Returns the registry value, or 'unknown' if unavailable.
*/
adIdRegistry: string;
/**
* The UniversalAdId of the selected creative for the ad.
*
* @remarks
* <br/> - Returns the id value or 'unknown' if unavailable.
*/
adIdValue: string;
}
/**
* Represents a non-linear ad in the VAST specification.
*
* @public
*/
export interface NonLinearAd extends Ad {
/**
* The alternative description for the ad.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
altText: string | undefined;
/**
* The website of the ad.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
clickThrough: string | undefined;
/**
* The HTML-string with the content of the ad.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
contentHTML: string | undefined;
}
/**
* The delivery type of the ad content file, represented by a value from the following list:
* <br/> - `'progressive'`: Delivered through progressive download protocols (e.g. HTTP).
* <br/> - `'streaming'`: Delivered through streaming download protocols.
*
* @remarks
* <br/> - `'streaming'` is currently not supported.
*
* @public
*/
export type DeliveryType = 'progressive' | 'streaming';
/**
* Represents metadata of an media file with ad content.
*
* @remarks
* <br/> - This metadata is retrieved from the VAST file.
*
* @public
*/
export interface MediaFile {
/**
* The delivery type of the video file.
*/
delivery: DeliveryType;
/**
* The MIME type for the file container.
*/
type: string;
/**
* The native width of the video file, in pixels.
*/
width: number;
/**
* The native height of the video file, in pixels.
*/
height: number;
/**
* The URI of the VAST content.
*/
contentURL: string;
}
/**
* Represents a linear ad in the VAST specification.
*
* @public
*/
export interface LinearAd extends Ad {
/**
* The duration of the ad, in seconds.
*
* @remarks
* <br/> - Available when the {@link Ad.readyState} is `'ready'`.
*/
duration: number;
/**
* List of media files which contain metadata about ad video files.
*/
mediaFiles: MediaFile[];
}