@openplayerjs/ads 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.js +2236 -3090
- package/dist/index.js.map +1 -1
- package/dist/openplayer-ads.js +1 -1
- package/dist/openplayer-ads.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,14 +24,16 @@ npm install @openplayer/ads @openplayer/core
|
|
|
24
24
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
|
-
- VAST 2.0 / 3.0 / 4.x linear ads
|
|
28
|
-
- VMAP ad break scheduling (pre-roll, mid-roll, post-roll)
|
|
27
|
+
- **VAST 2.0 / 3.0 / 4.x** linear ads
|
|
28
|
+
- **VMAP** ad break scheduling (pre-roll, mid-roll, post-roll)
|
|
29
29
|
- Non-linear (overlay) ads
|
|
30
30
|
- Companion ads
|
|
31
31
|
- Skip countdown and customisable skip button
|
|
32
32
|
- Click-through tracking
|
|
33
33
|
- Waterfall and playlist ad source modes
|
|
34
34
|
- Preload-aware VMAP fetching (respects `preload="none"`)
|
|
35
|
+
- **SIMID 1.2** — Secure Interactive Media Interface Definition (interactive overlays)
|
|
36
|
+
- **OMID** — Open Measurement Interface Definition (third-party viewability / verification)
|
|
35
37
|
|
|
36
38
|
---
|
|
37
39
|
|
|
@@ -200,6 +202,105 @@ core.on('ads:error', ({ reason, error }) => {
|
|
|
200
202
|
|
|
201
203
|
---
|
|
202
204
|
|
|
205
|
+
## SIMID 1.2 — Interactive Ad Creatives
|
|
206
|
+
|
|
207
|
+
[SIMID (Secure Interactive Media Interface Definition)](https://iabtechlab.com/standards/simid/) is an IAB standard that allows VAST ad creatives to render interactive overlays in an iframe alongside the video.
|
|
208
|
+
|
|
209
|
+
### How it works
|
|
210
|
+
|
|
211
|
+
When a VAST response includes an `<InteractiveCreativeFile apiFramework="SIMID">` element, the plugin automatically:
|
|
212
|
+
|
|
213
|
+
1. Mounts the creative URL in a sandboxed `<iframe>` over the ad video.
|
|
214
|
+
2. Runs the SIMID 1.2 handshake:
|
|
215
|
+
- Responds to the creative's `createSession` with a `resolve` + `SIMID:Player:init`.
|
|
216
|
+
- Replies to `SIMID:Creative:getMediaState` with the current media state.
|
|
217
|
+
- Sends `SIMID:Player:startCreative` when the creative signals it is ready.
|
|
218
|
+
3. Keeps the creative in sync with ad playback (progress, pause, resume, volume, skip, stop).
|
|
219
|
+
4. Handles creative-initiated actions: skip, stop, pause, play, click-through, fullscreen, tracking events.
|
|
220
|
+
|
|
221
|
+
No extra configuration is needed — detection and lifecycle management happen automatically.
|
|
222
|
+
|
|
223
|
+
### SIMID sandbox
|
|
224
|
+
|
|
225
|
+
The iframe is sandboxed with `allow-scripts allow-same-origin allow-forms allow-popups`. The creative's origin is preserved via `referrerpolicy="no-referrer-when-downgrade"`. The iframe is sized to cover the player container.
|
|
226
|
+
|
|
227
|
+
### Testing SIMID ads
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
new AdsPlugin({
|
|
231
|
+
sources: [
|
|
232
|
+
{
|
|
233
|
+
type: 'VAST',
|
|
234
|
+
// Google IMA SIMID test tag (replace correlator for each test):
|
|
235
|
+
src: `https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/simid&description_url=https%3A%2F%2Fdevelopers.google.com%2Finteractive-media-ads&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&correlator=${Date.now()}`,
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
});
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## OMID — Open Measurement
|
|
244
|
+
|
|
245
|
+
[OMID (Open Measurement Interface Definition)](https://iabtechlab.com/standards/open-measurement-sdk/) enables third-party viewability and verification measurement inside a VAST ad break.
|
|
246
|
+
|
|
247
|
+
### Requirements
|
|
248
|
+
|
|
249
|
+
The OMID Session Client SDK (`omweb-v1.js`) must be loaded on the page before ads play:
|
|
250
|
+
|
|
251
|
+
```html
|
|
252
|
+
<!-- Load the IAB OMID Session Client SDK before the player -->
|
|
253
|
+
<script src="https://iab-mm-omid.com/omweb-v1.js"></script>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
The plugin detects `window.OmidSessionClient` at runtime. If the SDK is absent OMID silently no-ops — ad playback is never blocked.
|
|
257
|
+
|
|
258
|
+
### How it works
|
|
259
|
+
|
|
260
|
+
When the VAST response contains `<AdVerifications>` entries, the plugin:
|
|
261
|
+
|
|
262
|
+
1. Injects each `<JavaScriptResource>` verification script as a `<script>` tag into the page.
|
|
263
|
+
2. Instantiates an `OmidSession` with the ad video element and all verification resources.
|
|
264
|
+
3. Fires the required OMID lifecycle events:
|
|
265
|
+
- `impression()` on ad impression
|
|
266
|
+
- `loaded()` with skip/autoplay/position metadata
|
|
267
|
+
- `start(duration, volume)` when the ad begins playing
|
|
268
|
+
- `firstQuartile()`, `midpoint()`, `thirdQuartile()`, `complete()` at the correct percentages
|
|
269
|
+
- `pause()` / `resume()` on pause/play
|
|
270
|
+
- `skipped()` when the ad is skipped
|
|
271
|
+
- `volumeChange(volume)` on volume changes
|
|
272
|
+
- `playerStateChange('fullscreen')` on fullscreen toggle
|
|
273
|
+
4. Calls `destroy()` when the break ends.
|
|
274
|
+
|
|
275
|
+
No extra configuration is needed — OMID runs automatically when the SDK and `<AdVerifications>` are both present.
|
|
276
|
+
|
|
277
|
+
### Access mode
|
|
278
|
+
|
|
279
|
+
By default, verification scripts run in `limited` access mode (no cross-origin DOM access). You can override this in the plugin config:
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
new AdsPlugin({
|
|
283
|
+
omid: { accessMode: 'domain' }, // 'limited' (default) | 'domain'
|
|
284
|
+
sources: [{ type: 'VAST', src: '...' }],
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Testing OMID ads
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
new AdsPlugin({
|
|
292
|
+
sources: [
|
|
293
|
+
{
|
|
294
|
+
type: 'VAST',
|
|
295
|
+
// Google IMA OMID test tag (replace correlator for each test):
|
|
296
|
+
src: `https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/omid_ad_samples&env=vp&gdfp_req=1&output=vast&sz=640x480&description_url=http%3A%2F%2Ftest_site.com%2Fhomepage&vpmute=0&vpa=0&vad_format=linear&url=http%3A%2F%2Ftest_site.com&vpos=preroll&unviewed_position_start=1&correlator=${Date.now()}`,
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
203
304
|
## Dependencies
|
|
204
305
|
|
|
205
306
|
| Package | Type | Required version |
|