@newrelic/video-core 4.0.0 → 4.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/video-core",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "New Relic video tracking core library",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -135,6 +135,12 @@ class VideoTrackerState {
135
135
  /** Content only. Chrono that counts time since last AD_END. */
136
136
  this.timeSinceLastAd = new Chrono();
137
137
 
138
+ /** Chrono that counts time since last error event. */
139
+ this.timeSinceLastError = new Chrono();
140
+
141
+ /** Chrono that counts time since last ad error event. */
142
+ this.timeSinceLastAdError = new Chrono();
143
+
138
144
  /** Chrono that counts time since last *_RESUME. Only for buffering events. */
139
145
  this.timeSinceResumed = new Chrono();
140
146
 
@@ -231,6 +237,12 @@ class VideoTrackerState {
231
237
  att.timeSinceAdSeekBegin = this.timeSinceSeekBegin.getDeltaTime();
232
238
  if (this.isAdBreak)
233
239
  att.timeSinceAdBreakBegin = this.timeSinceAdBreakStart.getDeltaTime();
240
+
241
+ // Only include timeSinceLastAdError if an ad error has occurred
242
+ if (this.numberOfErrors > 0 && this.timeSinceLastAdError.startTime > 0) {
243
+ att.timeSinceLastAdError = this.timeSinceLastAdError.getDeltaTime();
244
+ }
245
+
234
246
  att.numberOfAds = this.numberOfAds;
235
247
  } else {
236
248
  // Content only
@@ -247,6 +259,12 @@ class VideoTrackerState {
247
259
  if (this.isSeeking)
248
260
  att.timeSinceSeekBegin = this.timeSinceSeekBegin.getDeltaTime();
249
261
  att.timeSinceLastAd = this.timeSinceLastAd.getDeltaTime();
262
+
263
+ // Only include timeSinceLastError if a content error has occurred
264
+ if (this.numberOfErrors > 0 && this.timeSinceLastError.startTime > 0) {
265
+ att.timeSinceLastError = this.timeSinceLastError.getDeltaTime();
266
+ }
267
+
250
268
  att.numberOfVideos = this.numberOfVideos;
251
269
  }
252
270
  att.numberOfErrors = this.numberOfErrors;
@@ -556,11 +574,17 @@ class VideoTrackerState {
556
574
  }
557
575
 
558
576
  /**
559
- * Increments error counter.
577
+ * Increments error counter and starts appropriate error timer.
560
578
  */
561
579
  goError() {
562
580
  this.isError = true;
563
581
  this.numberOfErrors++;
582
+
583
+ if (this.isAd()) {
584
+ this.timeSinceLastAdError.start();
585
+ } else {
586
+ this.timeSinceLastError.start();
587
+ }
564
588
  }
565
589
 
566
590
  /**