@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 CHANGED
@@ -1,4 +1,4 @@
1
- ## [4.2.0](https://github.com/newrelic/video-videojs-js/compare/v4.1.1...v4.2.0) (2026-05-11)
1
+ ## [4.1.2](https://github.com/newrelic/video-videojs-js/compare/v4.1.1...v4.1.2) (2026-05-11)
2
2
 
3
3
  ### Features
4
4
 
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
- - **IMA (Interactive Media Ads)** - Google IMA SDK integration
445
- - **Freewheel** - Freewheel ad platform support
446
- - **SSAI (Server-Side Ad Insertion)** - Dynamic Ad Insertion (DAI) support
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
- ### SSAI/DAI Integration
507
+ See [Configuration Options → Ad Tracking](#ad-tracking) for full usage and examples.
449
508
 
450
- Server-Side Ad Insertion is supported with automatic tracker selection for supported integrations:
509
+ ### Google DAI Integration
451
510
 
452
511
  ```javascript
453
- // SSAI tracker selection is automatic for supported integrations
454
- const tracker = new VideojsTracker(player, options);
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
- **Example:** See [samples/dai/index.html](./samples/dai/index.html) for a complete SSAI implementation.
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
- The tracker automatically detects and tracks AWS MediaTailor SSAI streams. It supports:
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 VideojsTracker from '@newrelic/video-videojs';
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
- // Initialize tracker - MediaTailor support is automatic
490
- const tracker = new VideojsTracker(player, options);
491
- ```
530
+ const tracker = new VideojsTracker(player, { config: { ad: { type: AD_TRACKING.SSAI.MT } } });
492
531
 
493
- The tracker will automatically:
494
- 1. Detect MediaTailor URLs (`.mediatailor.` in URL)
495
- 2. Build the MediaTailor tracking endpoint from the sessionized playback URL
496
- 3. Parse HLS or DASH manifests for ad markers
497
- 4. Track ad breaks, ad starts, quartiles, and ad ends
498
- 5. Enrich ad metadata with the MediaTailor tracking endpoint when available
499
- 6. Handle VOD and LIVE streams appropriately
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
- MediaTailor-specific behavior is automatic. The customer does not need to pass MediaTailor-only configuration flags into the tracker.
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