@newrelic/video-core 4.1.0-beta → 4.1.1-beta

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.1.0-beta",
3
+ "version": "4.1.1-beta",
4
4
  "description": "New Relic video tracking core library",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -47,6 +47,7 @@ export function recordEvent(eventType, attributes = {}) {
47
47
  qoeEventObject = {
48
48
  eventType: "VideoAction",
49
49
  actionName: Tracker.Events.QOE_AGGREGATE,
50
+ qoeAggregateVersion: '1.0.0',
50
51
  ...qoeAttrs,
51
52
  ...metadataAttributes,
52
53
  ...otherAttrs,
@@ -93,6 +93,11 @@ class VideoTrackerState {
93
93
  */
94
94
  this._lastBitrate = null;
95
95
 
96
+ /**
97
+ * Tracks the last updated timestamp for bitrate
98
+ * */
99
+ this._lastBitrateChangeTimestamp = null;
100
+
96
101
  /**
97
102
  * total bitrate partial value for average weighted average bitrate
98
103
  */
@@ -691,11 +696,12 @@ class VideoTrackerState {
691
696
  this.peakBitrate = Math.max(this.peakBitrate, bitrate);
692
697
 
693
698
  if(this._lastBitrate === null || this._lastBitrate !== bitrate) {
694
- const totalPlaytime = this.timeSinceLastRenditionChange.getDeltaTime() || this.totalPlaytime;
695
- const currentWeightedBitrate = (bitrate * totalPlaytime);
699
+ const deltaPlaytime = this._lastBitrateChangeTimestamp === null ? this.totalPlaytime : Date.now() - this._lastBitrateChangeTimestamp;
700
+ const currentWeightedBitrate = (bitrate * deltaPlaytime);
696
701
  this.partialAverageBitrate += currentWeightedBitrate;
697
- this.weightedBitrate = currentWeightedBitrate / totalPlaytime;
702
+ this.weightedBitrate = currentWeightedBitrate / deltaPlaytime;
698
703
  this._lastBitrate = bitrate;
704
+ this._lastBitrateChangeTimestamp = Date.now();
699
705
  }
700
706
  }
701
707
  }
@@ -708,6 +714,7 @@ class VideoTrackerState {
708
714
  this.partialAverageBitrate = 0;
709
715
  this.startupTime = null;
710
716
  this._lastBitrate = null;
717
+ this._lastBitrateChangeTimestamp = null;
711
718
  }
712
719
 
713
720
  /** Methods to manage total ads time chrono */