@newrelic/video-videojs 4.1.0 → 4.1.2

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,3 +1,42 @@
1
+ ## [4.2.0](https://github.com/newrelic/video-videojs-js/compare/v4.1.1...v4.2.0) (2026-05-11)
2
+
3
+ ### Features
4
+
5
+ - **AWS MediaTailor Support:** Added comprehensive support for AWS MediaTailor SSAI with DASH
6
+ - Implemented MediaTailor tracker with manifest polling and ad tracking
7
+ - Added MediaTailor lab sample for testing and demonstration
8
+ - Enhanced DASH support for MediaTailor integration
9
+ - Added unit test cases for MediaTailor functionality
10
+ - Improved MediaTailor tracker reliability and event handling
11
+
12
+ ### Bug Fixes
13
+
14
+ - **Bitrate Data Types:** Updated bitrate data types for improved accuracy and consistency
15
+ - **Manifest Fetch Error Handling:** Added proper error handling for manifest fetch failures
16
+ - **MediaTailor Configuration:** Moved MediaTailor config variables to global scope for better accessibility
17
+
18
+ ### Documentation
19
+
20
+ - **SSAI Documentation:** Updated SSAI documentation to include MediaTailor integration details
21
+ - **MediaTailor Naming:** Clarified MediaTailor helper and state naming conventions
22
+
23
+ ### Build & Infrastructure
24
+
25
+ - **Release Workflow:** Standardized release workflow with smart detection
26
+ - **Dependencies:** Updated semantic-release dependencies and package-lock.json
27
+ - **Cleanup:** Removed unrelated test infrastructure files, scripts, and dependencies
28
+
29
+ ## [4.1.1](https://github.com/newrelic/video-videojs-js/compare/v4.1.0...v4.1.1) (2026-04-17)
30
+
31
+ ### Documentation
32
+
33
+ - **README.md:** Added Best Practices section (contentTitle, userId, custom attributes, gradual rollout with feature flags)
34
+ - **README.md:** Promoted Bitrate Metrics to top-level section with detailed table format and NRQL query examples
35
+ - **README.md:** Updated Data Model event descriptions to include heartbeats and media errors
36
+ - **README.md:** Fixed DATAMODEL.md link casing
37
+ - **README.md:** Updated Table of Contents with new sections (Prerequisites, Best Practices, Bitrate Metrics)
38
+ - **README.md:** Renamed Contributing to Contribute for consistency across trackers
39
+
1
40
  ## [4.1.0](https://github.com/newrelic/video-videojs-js/compare/v4.0.3...v4.1.0) (2026-04-08)
2
41
 
3
42
  ### Breaking Changes
package/README.md CHANGED
@@ -22,13 +22,17 @@ The New Relic Video.js Tracker provides comprehensive video analytics for applic
22
22
  - [Installation](#installation)
23
23
  - [Option 1: NPM/Yarn](#option-1-install-via-npmyarn)
24
24
  - [Option 2: Direct Script Include](#option-2-direct-script-include-without-npm)
25
+ - [Prerequisites](#prerequisites)
25
26
  - [Usage](#usage)
27
+ - [Best Practices](#best-practices)
26
28
  - [Configuration Options](#configuration-options)
27
29
  - [API Reference](#api-reference)
30
+ - [Bitrate Metrics](#bitrate-metrics)
28
31
  - [Ad Tracking Support](#ad-tracking-support)
32
+ - [SSAI Guide](#ssai-guide)
29
33
  - [Data Model](#data-model)
30
34
  - [Support](#support)
31
- - [Contributing](#contributing)
35
+ - [Contribute](#contribute)
32
36
  - [License](#license)
33
37
 
34
38
  ## Installation
@@ -91,11 +95,15 @@ For quick integration without a build system, include the tracker directly in yo
91
95
 
92
96
  **Setup Steps:**
93
97
 
94
- 1. **Get Configuration** - Visit [one.newrelic.com](https://one.newrelic.com) and complete the video agent onboarding to obtain your credentials (`licenseKey`, `beacon`, `applicationId`)
95
- 2. **Download Tracker** - Get `newrelic-video-videojs.min.js` from:
96
- - [GitHub Releases](https://github.com/newrelic/video-videojs-js/releases) (recommended)
97
- - Build from source: `npm run build` → `dist/umd/newrelic-video-videojs.min.js`
98
- 3. **Integrate** - Include the script in your HTML and initialize with your configuration
98
+ 1. **Get Configuration** - Visit [one.newrelic.com](https://one.newrelic.com) and follow the Streaming Video & Ads onboarding flow to get your `licenseKey`, `beacon`, `applicationID`, and integration code snippet.
99
+ 2. **Integrate** - Include the script in your HTML and initialize with your configuration
100
+
101
+ ## Prerequisites
102
+
103
+ Before using the tracker, ensure you have:
104
+
105
+ - **New Relic Account** - Active New Relic account with valid application credentials (`beacon`, `applicationId`, `licenseKey`)
106
+ - **Video.js Player** - Video.js player integrated in your application
99
107
 
100
108
  ## Usage
101
109
 
@@ -154,6 +162,148 @@ const options = {
154
162
  const tracker = new VideojsTracker(player, options);
155
163
  ```
156
164
 
165
+ ## Best Practices
166
+
167
+ ### 1. Setting `contentTitle`
168
+
169
+ The `contentTitle` attribute will display a value if your video metadata contains title information. If the metadata does not include a title, `contentTitle` will not be populated. For best results, ensure you explicitly set this attribute during initialization:
170
+
171
+ ```javascript
172
+ const tracker = new VideojsTracker(player, {
173
+ info: {
174
+ licenseKey: 'YOUR_LICENSE_KEY',
175
+ beacon: 'YOUR_BEACON_URL',
176
+ applicationId: 'YOUR_APP_ID',
177
+ },
178
+ customData: {
179
+ contentTitle: 'My Video Title', // Explicitly set from your metadata
180
+ },
181
+ });
182
+ ```
183
+
184
+ If your title changes dynamically (e.g., playlist or queue):
185
+
186
+ ```javascript
187
+ tracker.setOptions({
188
+ customData: {
189
+ contentTitle: 'New Video Title',
190
+ },
191
+ });
192
+ ```
193
+
194
+ ### 2. Setting `userId`
195
+
196
+ Set a user identifier to track video analytics per user:
197
+
198
+ ```javascript
199
+ // Set userId during initialization
200
+ const tracker = new VideojsTracker(player, {
201
+ info: {
202
+ licenseKey: 'YOUR_LICENSE_KEY',
203
+ beacon: 'YOUR_BEACON_URL',
204
+ applicationId: 'YOUR_APP_ID',
205
+ },
206
+ customData: {
207
+ contentTitle: 'Video Title',
208
+ userId: 'user-12345',
209
+ },
210
+ });
211
+
212
+ // Or set userId separately using the API method
213
+ tracker.setUserId('user-12345');
214
+ ```
215
+
216
+ ### 3. Adding Custom Attributes for Your Deployment
217
+
218
+ Add custom attributes unique to your deployment to improve data aggregation and analysis:
219
+
220
+ ```javascript
221
+ const tracker = new VideojsTracker(player, {
222
+ info: {
223
+ licenseKey: 'YOUR_LICENSE_KEY',
224
+ beacon: 'YOUR_BEACON_URL',
225
+ applicationId: 'YOUR_APP_ID',
226
+ },
227
+ customData: {
228
+ // Required for identification
229
+ contentTitle: videoMetadata.title,
230
+ userId: currentUser.id,
231
+
232
+ // Custom attributes for your deployment
233
+ subscriptionTier: 'premium', // User subscription level
234
+ contentProvider: 'studio-abc', // Content source
235
+ region: 'us-west-2', // Geographic region
236
+ cdnProvider: 'cloudflare', // CDN being used
237
+ deviceType: 'desktop', // Device category
238
+ appVersion: '2.1.0', // Your app version
239
+ campaign: 'spring-promo', // Marketing campaign
240
+ },
241
+ });
242
+ ```
243
+
244
+ **Use these attributes in New Relic queries:**
245
+
246
+ ```sql
247
+ -- Analyze by subscription tier
248
+ SELECT count(*) FROM VideoAction WHERE actionName = 'CONTENT_START'
249
+ FACET subscriptionTier SINCE 1 day ago
250
+
251
+ -- Monitor by region
252
+ SELECT average(contentNetworkDownloadBitrate) FROM VideoAction
253
+ FACET region SINCE 1 hour ago
254
+ ```
255
+
256
+ ### 4. Gradual Rollout with Feature Flags
257
+
258
+ When deploying to production, use feature flags to enable the tracker gradually. This helps you:
259
+
260
+ - Validate data collection without impacting all users
261
+ - Monitor performance impact at scale
262
+ - Catch issues before full deployment
263
+ - Control monitoring costs
264
+
265
+ ```javascript
266
+ // Example using a feature flag
267
+ const rolloutPercentage = 5; // Start with 5% of users
268
+
269
+ function shouldEnableTracking(userId) {
270
+ // Simple percentage-based rollout
271
+ const hash = userId
272
+ .split('')
273
+ .reduce((acc, char) => acc + char.charCodeAt(0), 0);
274
+ return hash % 100 < rolloutPercentage;
275
+ }
276
+
277
+ const player = videojs('myVideo');
278
+ player.version = videojs.VERSION;
279
+
280
+ // Only initialize tracker if user is in rollout
281
+ if (shouldEnableTracking(currentUser.id)) {
282
+ const tracker = new VideojsTracker(player, {
283
+ info: {
284
+ licenseKey: 'YOUR_LICENSE_KEY',
285
+ beacon: 'YOUR_BEACON_URL',
286
+ applicationId: 'YOUR_APP_ID',
287
+ },
288
+ customData: {
289
+ contentTitle: videoMetadata.title,
290
+ userId: currentUser.id,
291
+ rolloutGroup: `${rolloutPercentage}%`, // Track which rollout group
292
+ },
293
+ });
294
+ }
295
+ ```
296
+
297
+ **Recommended Rollout Schedule:**
298
+
299
+ | Phase | Percentage | Duration | Validation |
300
+ | --------- | ---------- | --------- | ---------------------------------- |
301
+ | Initial | 5% | 2-3 days | Verify data flowing to New Relic |
302
+ | Early | 15% | 3-5 days | Check data quality and performance |
303
+ | Expansion | 25% | 5-7 days | Validate across device types |
304
+ | Majority | 50% | 1-2 weeks | Monitor at scale |
305
+ | Full | 100% | Ongoing | Complete deployment |
306
+
157
307
  ## Configuration Options
158
308
 
159
309
  ### QoE (Quality of Experience) Settings
@@ -177,6 +327,10 @@ customData: {
177
327
  }
178
328
  ```
179
329
 
330
+ > **Limit:** The maximum total number of custom attributes per event is **150**. Any attributes beyond this limit will be dropped.
331
+
332
+ > **Note:** There are special reserved keywords used for default attributes (such as `actionName`, `contentBitrate`, `playerName`, `viewSession`, etc.). Please do not use these as custom attribute names, as they will be dropped. See [DATAMODEL.md](./DATAMODEL.md) for the complete list of reserved attribute names.
333
+
180
334
  ## API Reference
181
335
 
182
336
  ### Core Methods
@@ -259,6 +413,28 @@ player.on('userEngagement', () => {
259
413
  });
260
414
  ```
261
415
 
416
+ ## Bitrate Metrics
417
+
418
+ The tracker captures four distinct bitrate metrics providing complete quality analysis:
419
+
420
+ | Attribute | Description | Use Case |
421
+ | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
422
+ | `contentBitrate` | Encoding bitrate (in bps) of the currently playing rendition from the manifest | Monitor actual video quality being delivered |
423
+ | `contentManifestBitrate` | Maximum available bitrate (in bps) across all renditions in the manifest. Represents the highest quality capability of the stream | Understand maximum quality potential |
424
+ | `contentSegmentDownloadBitrate` | ABR estimated bandwidth (in bps) from the player's stats object, used by the ABR algorithm for quality switching decisions | Analyze ABR decision-making |
425
+ | `contentNetworkDownloadBitrate` | Instantaneous download throughput (in bps) from the most recent segment download. Represents raw network download speed | Monitor real-time network performance |
426
+
427
+ ### Bitrate Monitoring Example
428
+
429
+ ```javascript
430
+ // All bitrate metrics are automatically captured and sent with each event
431
+ // Access them in New Relic Insights queries:
432
+
433
+ // NRQL Query Examples:
434
+ // SELECT average(contentNetworkDownloadBitrate) FROM VideoAction WHERE actionName = 'CONTENT_HEARTBEAT'
435
+ // SELECT contentBitrate, contentSegmentDownloadBitrate FROM VideoAction WHERE actionName = 'CONTENT_RENDITION_CHANGE'
436
+ ```
437
+
262
438
  ## Ad Tracking Support
263
439
 
264
440
  The tracker provides comprehensive ad tracking capabilities:
@@ -271,39 +447,94 @@ The tracker provides comprehensive ad tracking capabilities:
271
447
 
272
448
  ### SSAI/DAI Integration
273
449
 
274
- Server-Side Ad Insertion is fully supported with automatic detection and tracking:
450
+ Server-Side Ad Insertion is supported with automatic tracker selection for supported integrations:
275
451
 
276
452
  ```javascript
277
- // SSAI is automatically detected - no additional configuration needed
453
+ // SSAI tracker selection is automatic for supported integrations
278
454
  const tracker = new VideojsTracker(player, options);
279
455
 
280
456
  // The tracker will automatically capture:
281
457
  // - Ad breaks, starts, and completions
282
458
  // - Ad quartiles and click events
283
- // - SSAI-specific metadata
459
+ // - SSAI-specific metadata when available
284
460
  ```
285
461
 
286
462
  **Example:** See [samples/dai/index.html](./samples/dai/index.html) for a complete SSAI implementation.
287
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).
467
+
468
+ ### AWS MediaTailor Integration
469
+
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
479
+
480
+ ```javascript
481
+ import VideojsTracker from '@newrelic/video-videojs';
482
+
483
+ // Initialize player with a sessionized MediaTailor playback URL
484
+ player.src({
485
+ src: 'https://your-mediatailor-endpoint.mediatailor.region.amazonaws.com/v1/master/...',
486
+ type: 'application/x-mpegURL'
487
+ });
488
+
489
+ // Initialize tracker - MediaTailor support is automatic
490
+ const tracker = new VideojsTracker(player, options);
491
+ ```
492
+
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
500
+
501
+ MediaTailor-specific behavior is automatic. The customer does not need to pass MediaTailor-only configuration flags into the tracker.
502
+
503
+ ## SSAI Guide
504
+
505
+ For customer-facing SSAI integration details, supported MediaTailor behavior, troubleshooting guidance, and sample usage, see [docs/ssai.md](./docs/ssai.md).
506
+
507
+
508
+ ## Testing
509
+
510
+ This project includes comprehensive unit tests for all tracker functionality.
511
+
512
+ ```bash
513
+ # Install dependencies
514
+ npm install
515
+
516
+ # Run tests
517
+ npm test
518
+
519
+ # Run tests with coverage
520
+ npm run test:coverage
521
+
522
+ # Run tests in watch mode
523
+ npm run test:watch
524
+ ```
525
+
526
+ For more details, see [test/README.md](./test/README.md).
527
+
288
528
  ## Data Model
289
529
 
290
530
  The tracker captures comprehensive video analytics across four event types:
291
531
 
292
- - **VideoAction** - Playback events (play, pause, buffer, seek, quality changes)
532
+ - **VideoAction** - Playback events (play, pause, buffer, seek, quality changes, heartbeats)
293
533
  - **VideoAdAction** - Ad events (ad start, quartiles, completions, clicks)
294
- - **VideoErrorAction** - Error events (playback failures, network errors)
534
+ - **VideoErrorAction** - Error events (playback failures, network errors, media errors)
295
535
  - **VideoCustomAction** - Custom events defined by your application
296
536
 
297
- ### Bitrate Metrics
298
-
299
- Four distinct bitrate metrics provide complete quality analysis:
300
-
301
- - `contentBitrate` - Current rendition encoding bitrate
302
- - `contentManifestBitrate` - Maximum available quality
303
- - `contentSegmentDownloadBitrate` - ABR bandwidth estimate
304
- - `contentNetworkDownloadBitrate` - Instantaneous throughput
305
-
306
- **Full Documentation:** See [datamodel.md](./datamodel.md) for complete event and attribute reference.
537
+ **Full Documentation:** See [DATAMODEL.md](./DATAMODEL.md) for complete event and attribute reference.
307
538
 
308
539
  ## Support
309
540
 
@@ -320,11 +551,11 @@ If the issue has been confirmed as a bug or is a feature request, please file a
320
551
 
321
552
  ### Additional Resources
322
553
 
323
- - **[datamodel.md](./datamodel.md)** - Complete event and attribute reference
554
+ - **[DATAMODEL.md](./DATAMODEL.md)** - Complete event and attribute reference
324
555
  - **[DEVELOPING.md](./DEVELOPING.md)** - Building and testing instructions
325
556
  - **[REVIEW.md](./REVIEW.md)** - Code review guidelines
326
557
 
327
- ## Contributing
558
+ ## Contribute
328
559
 
329
560
  We encourage your contributions to improve the Video.js Tracker! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
330
561
 
@@ -332,14 +563,12 @@ If you have any questions, or to execute our corporate CLA (which is required if
332
563
 
333
564
  For more details on how best to contribute, see [CONTRIBUTING.md](./CONTRIBUTING.md).
334
565
 
335
- ### A Note About Vulnerabilities
566
+ ### A note about vulnerabilities
336
567
 
337
568
  As noted in our [security policy](../../security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
338
569
 
339
570
  If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through our [bug bounty program](https://docs.newrelic.com/docs/security/security-privacy/information-security/report-security-vulnerabilities/).
340
571
 
341
- ### Acknowledgments
342
-
343
572
  If you would like to contribute to this project, review [these guidelines](./CONTRIBUTING.md).
344
573
 
345
574
  To all contributors, we thank you! Without your contribution, this project would not be what it is today.