@newrelic/video-videojs 4.1.2 → 4.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/CHANGELOG.md +1 -1
- package/README.md +83 -41
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.LICENSE.txt +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.LICENSE.txt +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/newrelic-video-videojs.min.js +1 -1
- package/dist/umd/newrelic-video-videojs.min.js.LICENSE.txt +1 -1
- package/dist/umd/newrelic-video-videojs.min.js.map +1 -1
- package/package.json +1 -1
- package/src/ads/media-tailor.js +126 -91
- package/src/ads/utils/mt-constants.js +2 -1
- package/src/ads/utils/mt.js +44 -22
- package/src/register-plugin.js +2 -2
- package/src/tracker.js +118 -16
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -306,6 +306,53 @@ if (shouldEnableTracking(currentUser.id)) {
|
|
|
306
306
|
|
|
307
307
|
## Configuration Options
|
|
308
308
|
|
|
309
|
+
### Ad Tracking
|
|
310
|
+
|
|
311
|
+
`config.ad.type` declares which ad category the tracker should wire up. **If not set, no ad tracking runs** — this is the safe default. Omitting it while passing other options triggers a console warning.
|
|
312
|
+
|
|
313
|
+
#### CSAI — Client-Side Ad Insertion
|
|
314
|
+
|
|
315
|
+
All CSAI frameworks (IMA, Brightcove IMA, Freewheel) share the `adsready` event path. The tracker auto-detects which one is present — no sub-type needed. Just declare `CSAI`.
|
|
316
|
+
|
|
317
|
+
| Value | Constant | Behaviour |
|
|
318
|
+
| -------- | ---------------- | -------------------------------------------------------------------------- |
|
|
319
|
+
| `'csai'` | `AD_TRACKING.CSAI` | Auto-detects: Brightcove IMA → IMA → Freewheel → generic fallback |
|
|
320
|
+
|
|
321
|
+
#### SSAI — Server-Side Ad Insertion
|
|
322
|
+
|
|
323
|
+
Each SSAI platform has its own SDK and a completely different activation path — they cannot be auto-detected. **A sub-type is always required.**
|
|
324
|
+
|
|
325
|
+
| Value | Constant | Behaviour |
|
|
326
|
+
| ------------ | ---------------------- | ----------------------------------------------------------------------- |
|
|
327
|
+
| `'ssai:dai'` | `AD_TRACKING.SSAI.DAI` | Google DAI (`google.ima.dai.api`) |
|
|
328
|
+
| `'ssai:mt'` | `AD_TRACKING.SSAI.MT` | AWS MediaTailor |
|
|
329
|
+
|
|
330
|
+
```javascript
|
|
331
|
+
import { AD_TRACKING } from '@newrelic/video-videojs';
|
|
332
|
+
|
|
333
|
+
// CSAI — one value covers all client-side frameworks
|
|
334
|
+
new VideojsTracker(player, { config: { ad: { type: AD_TRACKING.CSAI } } });
|
|
335
|
+
|
|
336
|
+
// SSAI — sub-type always required
|
|
337
|
+
new VideojsTracker(player, { config: { ad: { type: AD_TRACKING.SSAI.DAI } } });
|
|
338
|
+
new VideojsTracker(player, { config: { ad: { type: AD_TRACKING.SSAI.MT } } });
|
|
339
|
+
|
|
340
|
+
// SSAI.MT with custom CDN config
|
|
341
|
+
new VideojsTracker(player, {
|
|
342
|
+
config: {
|
|
343
|
+
ad: {
|
|
344
|
+
type: AD_TRACKING.SSAI.MT,
|
|
345
|
+
segmentPrefix: '/my-cdn-path/',
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Change at runtime before first loadstart / adsready
|
|
351
|
+
tracker.setAdTracking(AD_TRACKING.CSAI);
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
> **Extending later:** add a new key to `AD_TRACKING.SSAI` — validation derives from the object automatically. No other changes needed.
|
|
355
|
+
|
|
309
356
|
### QoE (Quality of Experience) Settings
|
|
310
357
|
|
|
311
358
|
| Option | Type | Default | Description |
|
|
@@ -378,6 +425,18 @@ tracker.setOptions({
|
|
|
378
425
|
});
|
|
379
426
|
```
|
|
380
427
|
|
|
428
|
+
#### `tracker.setAdTracking(type)`
|
|
429
|
+
|
|
430
|
+
Change the ad tracking mode after the tracker is created. Must be called before the first `loadstart` or `adsready` event to take effect.
|
|
431
|
+
|
|
432
|
+
```javascript
|
|
433
|
+
import { AD_TRACKING } from '@newrelic/video-videojs';
|
|
434
|
+
|
|
435
|
+
// Valid values: 'csai' | 'ssai:dai' | 'ssai:mt'
|
|
436
|
+
tracker.setAdTracking(AD_TRACKING.CSAI);
|
|
437
|
+
tracker.setAdTracking(AD_TRACKING.SSAI.MT);
|
|
438
|
+
```
|
|
439
|
+
|
|
381
440
|
### Example: Complete Integration
|
|
382
441
|
|
|
383
442
|
```javascript
|
|
@@ -437,68 +496,51 @@ The tracker captures four distinct bitrate metrics providing complete quality an
|
|
|
437
496
|
|
|
438
497
|
## Ad Tracking Support
|
|
439
498
|
|
|
440
|
-
The tracker provides comprehensive ad tracking capabilities:
|
|
441
|
-
|
|
442
499
|
### Supported Ad Technologies
|
|
443
500
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
501
|
+
| Category | Frameworks detected | Constant |
|
|
502
|
+
|---|---|---|
|
|
503
|
+
| CSAI | Google IMA, Brightcove IMA, Freewheel, generic | `AD_TRACKING.CSAI` |
|
|
504
|
+
| SSAI | Google DAI | `AD_TRACKING.SSAI.DAI` |
|
|
505
|
+
| SSAI | AWS MediaTailor | `AD_TRACKING.SSAI.MT` |
|
|
447
506
|
|
|
448
|
-
|
|
507
|
+
See [Configuration Options → Ad Tracking](#ad-tracking) for full usage and examples.
|
|
449
508
|
|
|
450
|
-
|
|
509
|
+
### Google DAI Integration
|
|
451
510
|
|
|
452
511
|
```javascript
|
|
453
|
-
|
|
454
|
-
const tracker = new VideojsTracker(player,
|
|
455
|
-
|
|
456
|
-
// The tracker will automatically capture:
|
|
457
|
-
// - Ad breaks, starts, and completions
|
|
458
|
-
// - Ad quartiles and click events
|
|
459
|
-
// - SSAI-specific metadata when available
|
|
512
|
+
import { AD_TRACKING } from '@newrelic/video-videojs';
|
|
513
|
+
const tracker = new VideojsTracker(player, { config: { ad: { type: AD_TRACKING.SSAI.DAI } } });
|
|
460
514
|
```
|
|
461
515
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
> [!NOTE]
|
|
465
|
-
> **Attention:**
|
|
466
|
-
> This version supports tracking for SSAI (Server-Side Ad Insertion), including AWS MediaTailor. See [samples/media-tailor-lab.html](./samples/media-tailor-lab.html) and the [SSAI Guide](./docs/ssai.md).
|
|
516
|
+
See [samples/dai/index.html](./samples/dai/index.html) for a complete example.
|
|
467
517
|
|
|
468
518
|
### AWS MediaTailor Integration
|
|
469
519
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
- **HLS and DASH** manifest formats
|
|
473
|
-
- **VOD and LIVE** stream types
|
|
474
|
-
- **Multiple ads (pods)** within a single break
|
|
475
|
-
- **Quartile tracking** (25%, 50%, 75%)
|
|
476
|
-
- **Tracking metadata enrichment** when MediaTailor tracking data is available
|
|
477
|
-
|
|
478
|
-
#### Usage
|
|
520
|
+
Supports HLS/DASH, VOD/LIVE, multiple ads per break, quartile tracking, and tracking metadata enrichment.
|
|
479
521
|
|
|
480
522
|
```javascript
|
|
481
|
-
import
|
|
523
|
+
import { AD_TRACKING } from '@newrelic/video-videojs';
|
|
482
524
|
|
|
483
|
-
// Initialize player with a sessionized MediaTailor playback URL
|
|
484
525
|
player.src({
|
|
485
526
|
src: 'https://your-mediatailor-endpoint.mediatailor.region.amazonaws.com/v1/master/...',
|
|
486
527
|
type: 'application/x-mpegURL'
|
|
487
528
|
});
|
|
488
529
|
|
|
489
|
-
|
|
490
|
-
const tracker = new VideojsTracker(player, options);
|
|
491
|
-
```
|
|
530
|
+
const tracker = new VideojsTracker(player, { config: { ad: { type: AD_TRACKING.SSAI.MT } } });
|
|
492
531
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
532
|
+
// With custom CDN config
|
|
533
|
+
const tracker = new VideojsTracker(player, {
|
|
534
|
+
config: {
|
|
535
|
+
ad: {
|
|
536
|
+
type: AD_TRACKING.SSAI.MT,
|
|
537
|
+
segmentPrefix: '/my-cdn-path/',
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
});
|
|
541
|
+
```
|
|
500
542
|
|
|
501
|
-
|
|
543
|
+
Works with default AWS hostnames and custom CDN domains. See [docs/ssai.md](./docs/ssai.md) for custom CDN setup and advanced options.
|
|
502
544
|
|
|
503
545
|
## SSAI Guide
|
|
504
546
|
|