@newrelic/video-core 5.0.2 → 5.1.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +13 -0
  3. package/dist/cjs/browser/index.js +1 -1
  4. package/dist/cjs/browser/index.js.LICENSE.txt +1 -1
  5. package/dist/cjs/browser/index.js.map +1 -1
  6. package/dist/cjs/index.js +1 -1
  7. package/dist/cjs/index.js.LICENSE.txt +1 -1
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/vega/index.js +1 -1
  10. package/dist/cjs/vega/index.js.LICENSE.txt +1 -1
  11. package/dist/cjs/vega/index.js.map +1 -1
  12. package/dist/esm/browser/index.js +1 -1
  13. package/dist/esm/browser/index.js.LICENSE.txt +1 -1
  14. package/dist/esm/browser/index.js.map +1 -1
  15. package/dist/esm/index.js +1 -1
  16. package/dist/esm/index.js.LICENSE.txt +1 -1
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/vega/index.js +1 -1
  19. package/dist/esm/vega/index.js.LICENSE.txt +1 -1
  20. package/dist/esm/vega/index.js.map +1 -1
  21. package/dist/types/browser/agent.d.ts +46 -0
  22. package/dist/types/browser/harvestScheduler.d.ts +125 -0
  23. package/dist/types/browser/index.d.ts +34 -0
  24. package/dist/types/chrono.d.ts +52 -0
  25. package/dist/types/connectedDevice/connectedDeviceAgent.d.ts +63 -0
  26. package/dist/types/connectedDevice/connectedDeviceConstants.d.ts +51 -0
  27. package/dist/types/connectedDevice/connectedDeviceHarvester.d.ts +198 -0
  28. package/dist/types/connectedDevice/index.d.ts +30 -0
  29. package/dist/types/constants.d.ts +30 -0
  30. package/dist/types/core.d.ts +54 -0
  31. package/dist/types/emitter.d.ts +42 -0
  32. package/dist/types/eventAggregator.d.ts +97 -0
  33. package/dist/types/index.d.ts +33 -0
  34. package/dist/types/log.d.ts +61 -0
  35. package/dist/types/obfuscate.d.ts +13 -0
  36. package/dist/types/optimizedHttpClient.d.ts +83 -0
  37. package/dist/types/recordEvent.d.ts +30 -0
  38. package/dist/types/retryQueueHandler.d.ts +46 -0
  39. package/dist/types/tracker.d.ts +176 -0
  40. package/dist/types/utils/eventBuilder.d.ts +69 -0
  41. package/dist/types/utils/harvestTimer.d.ts +45 -0
  42. package/dist/types/utils/index.d.ts +38 -0
  43. package/dist/types/utils/qoeFilters.d.ts +88 -0
  44. package/dist/types/videoConfiguration.d.ts +90 -0
  45. package/dist/types/videotracker.d.ts +366 -0
  46. package/dist/types/videotrackerstate.d.ts +228 -0
  47. package/dist/umd/nrvideo.min.js +1 -1
  48. package/dist/umd/nrvideo.min.js.LICENSE.txt +1 -1
  49. package/dist/umd/nrvideo.min.js.map +1 -1
  50. package/package.json +14 -2
  51. package/src/browser/{agent.js → agent.ts} +21 -16
  52. package/src/browser/{harvestScheduler.js → harvestScheduler.ts} +51 -24
  53. package/src/{chrono.js → chrono.ts} +29 -24
  54. package/src/connectedDevice/{connectedDeviceAgent.js → connectedDeviceAgent.ts} +14 -10
  55. package/src/connectedDevice/{connectedDeviceConstants.js → connectedDeviceConstants.ts} +5 -3
  56. package/src/connectedDevice/{connectedDeviceHarvester.js → connectedDeviceHarvester.ts} +71 -34
  57. package/src/constants.ts +62 -0
  58. package/src/{core.js → core.ts} +31 -18
  59. package/src/{emitter.js → emitter.ts} +16 -5
  60. package/src/{eventAggregator.js → eventAggregator.ts} +33 -19
  61. package/src/global.d.ts +25 -0
  62. package/src/{log.js → log.ts} +23 -17
  63. package/src/{obfuscate.js → obfuscate.ts} +6 -1
  64. package/src/{optimizedHttpClient.js → optimizedHttpClient.ts} +37 -13
  65. package/src/{recordEvent.js → recordEvent.ts} +11 -9
  66. package/src/{retryQueueHandler.js → retryQueueHandler.ts} +17 -12
  67. package/src/{tracker.js → tracker.ts} +56 -23
  68. package/src/utils/{eventBuilder.js → eventBuilder.ts} +31 -14
  69. package/src/utils/{harvestTimer.js → harvestTimer.ts} +21 -4
  70. package/src/utils/{index.js → index.ts} +14 -14
  71. package/src/utils/{qoeFilters.js → qoeFilters.ts} +19 -8
  72. package/src/{videoConfiguration.js → videoConfiguration.ts} +44 -10
  73. package/src/{videotracker.js → videotracker.ts} +119 -78
  74. package/src/{videotrackerstate.js → videotrackerstate.ts} +113 -49
  75. package/src/constants.js +0 -63
  76. /package/src/browser/{index.js → index.ts} +0 -0
  77. /package/src/connectedDevice/{index.js → index.ts} +0 -0
  78. /package/src/{index.js → index.ts} +0 -0
@@ -5,6 +5,70 @@ import Log from "./log";
5
5
  * State machine for a VideoTracker and its monitored video.
6
6
  */
7
7
  class VideoTrackerState {
8
+ _viewSession: string | null = null;
9
+ _viewCount: number = 0;
10
+ _isAd: boolean = false;
11
+ numberOfErrors: number = 0;
12
+ numberOfAds: number = 0;
13
+ numberOfVideos: number = 0;
14
+ totalPlaytime: number = 0;
15
+ weightedAverageBitrate: number = 0;
16
+ totalAdPlaytime: number = 0;
17
+ isAdBreak: boolean = false;
18
+ initialBufferingHappened: boolean = false;
19
+ startupTime: number | null = null;
20
+ peakBitrate: number = 0;
21
+ partialAverageBitrate: number = 0;
22
+ _totalBitrateDuration: number = 0;
23
+ weightedBitrate: number = 0;
24
+ _lastBitrate: number | null = null;
25
+ _lastBitrateChangeTimestamp: number | null = null;
26
+ _downloadBitrates: number[] = [];
27
+ _lastDownloadBitrate: number | null = null;
28
+ totalSwitchUps: number = 0;
29
+ totalSwitchDowns: number = 0;
30
+ totalPauseTime: number = 0;
31
+ _playedRenditions: Set<string> = new Set();
32
+ hadStartupError: boolean = false;
33
+ hadPlaybackError: boolean = false;
34
+ totalRebufferingTime: number = 0;
35
+
36
+ isPlayerReady: boolean = false;
37
+ isRequested: boolean = false;
38
+ isStarted: boolean = false;
39
+ isPaused: boolean = false;
40
+ isSeeking: boolean = false;
41
+ isBuffering: boolean = false;
42
+ isPlaying: boolean = false;
43
+
44
+ timeSinceRequested!: Chrono;
45
+ timeSinceStarted!: Chrono;
46
+ timeSincePaused!: Chrono;
47
+ timeSinceSeekBegin!: Chrono;
48
+ timeSinceBufferBegin!: Chrono;
49
+ timeSinceAdBreakStart!: Chrono;
50
+ timeSinceLastDownload!: Chrono;
51
+ timeSinceLastHeartbeat!: Chrono;
52
+ timeSinceLastRenditionChange!: Chrono;
53
+ timeSinceLastAdQuartile!: Chrono;
54
+ timeSinceLastAd!: Chrono;
55
+ timeSinceLastError!: Chrono;
56
+ timeSinceLastAdError!: Chrono;
57
+ timeSinceResumed!: Chrono;
58
+ timeSinceSeekEnd!: Chrono;
59
+ playtimeSinceLastEvent!: Chrono;
60
+ customTimeSinceAttributes: Record<string, Chrono> = {};
61
+ elapsedTime!: Chrono;
62
+ bufferElapsedTime!: Chrono;
63
+ _totalAdPlaytime!: Chrono;
64
+
65
+ /** @private */
66
+ _createdAt: number;
67
+ _hb: boolean;
68
+ _acc: number;
69
+ _bufferAcc: number;
70
+ isError?: boolean;
71
+
8
72
  /** Constructor */
9
73
  constructor() {
10
74
  this.reset();
@@ -22,7 +86,7 @@ class VideoTrackerState {
22
86
  }
23
87
 
24
88
  /** Resets all flags and chronos. */
25
- reset() {
89
+ reset(): void {
26
90
  /**
27
91
  * Unique identifier of the view.
28
92
  * @private
@@ -149,7 +213,7 @@ class VideoTrackerState {
149
213
  }
150
214
 
151
215
  /** Resets flags. */
152
- resetFlags() {
216
+ resetFlags(): void {
153
217
  /** True once the player has finished loading. */
154
218
  this.isPlayerReady = false;
155
219
 
@@ -173,7 +237,7 @@ class VideoTrackerState {
173
237
  }
174
238
 
175
239
  /** Resets chronos. */
176
- resetChronos() {
240
+ resetChronos(): void {
177
241
  /** Chrono that counts time since last requested event. */
178
242
  this.timeSinceRequested = new Chrono();
179
243
 
@@ -234,12 +298,12 @@ class VideoTrackerState {
234
298
  }
235
299
 
236
300
  /** Returns true if the tracker is currently on ads. */
237
- isAd() {
301
+ isAd(): boolean {
238
302
  return this._isAd;
239
303
  }
240
304
 
241
305
  /** Sets if the tracker is currenlty tracking ads */
242
- setIsAd(isAd) {
306
+ setIsAd(isAd: boolean): void {
243
307
  this._isAd = isAd;
244
308
  }
245
309
 
@@ -248,7 +312,7 @@ class VideoTrackerState {
248
312
  *
249
313
  * @param {object} name Time since attribute name.
250
314
  */
251
- setTimeSinceAttribute(name) {
315
+ setTimeSinceAttribute(name: string): void {
252
316
  this.customTimeSinceAttributes[name] = new Chrono();
253
317
  this.customTimeSinceAttributes[name].start();
254
318
  }
@@ -258,14 +322,14 @@ class VideoTrackerState {
258
322
  *
259
323
  * @param {object} name Time since attribute name.
260
324
  */
261
- removeTimeSinceAttribute(name) {
325
+ removeTimeSinceAttribute(name: string): void {
262
326
  delete this.customTimeSinceAttributes[name];
263
327
  }
264
328
 
265
329
  /**
266
330
  * Returns a random-generated view Session ID, useful to sort by views.
267
331
  */
268
- getViewSession() {
332
+ getViewSession(): string {
269
333
  if (!this._viewSession) {
270
334
  let time = new Date().getTime();
271
335
  let random =
@@ -282,7 +346,7 @@ class VideoTrackerState {
282
346
  * Returns a random-generated view Session ID, plus a view count, allowing you to distinguish
283
347
  * between two videos played in the same session.
284
348
  */
285
- getViewId() {
349
+ getViewId(): string {
286
350
  return this.getViewSession() + "-" + this._viewCount;
287
351
  }
288
352
 
@@ -292,7 +356,7 @@ class VideoTrackerState {
292
356
  * @param {object} att Collection fo key value attributes
293
357
  * @return {object} Filled attributes
294
358
  */
295
- getStateAttributes(att) {
359
+ getStateAttributes(att?: Record<string, any>): Record<string, any> {
296
360
  att = att || {};
297
361
 
298
362
  if (this.isAd()) {
@@ -368,9 +432,9 @@ class VideoTrackerState {
368
432
  return att;
369
433
  }
370
434
 
371
- getQoeAttributes(att) {
435
+ getQoeAttributes(att?: Record<string, any>): Record<string, any> {
372
436
  att = att || {};
373
- const kpi = {};
437
+ const kpi: Record<string, any> = {};
374
438
 
375
439
  try {
376
440
  // QoE v1 KPIs
@@ -412,7 +476,7 @@ class VideoTrackerState {
412
476
  // Version tag
413
477
  kpi["qoeAggregateVersion"] = "1.1.0";
414
478
 
415
- } catch (error) {
479
+ } catch (error: any) {
416
480
  Log.error("Failed to add attributes for QOE KPIs", error.message);
417
481
  }
418
482
 
@@ -425,7 +489,7 @@ class VideoTrackerState {
425
489
  *
426
490
  * @param {boolean} isInitialBuffering Is initial buffering event.
427
491
  */
428
- calculateBufferType(isInitialBuffering) {
492
+ calculateBufferType(isInitialBuffering: boolean): string {
429
493
  let bufferType = "";
430
494
  if (isInitialBuffering) {
431
495
  bufferType = "initial";
@@ -445,7 +509,7 @@ class VideoTrackerState {
445
509
  /**
446
510
  * Augments view count. This will be called with each *_START and *_END.
447
511
  */
448
- goViewCountUp() {
512
+ goViewCountUp(): void {
449
513
  this._viewCount++;
450
514
  }
451
515
 
@@ -453,7 +517,7 @@ class VideoTrackerState {
453
517
  * Checks flags and changes state.
454
518
  * @returns {boolean} True if the state changed.
455
519
  */
456
- goPlayerReady() {
520
+ goPlayerReady(): boolean {
457
521
  if (!this.isPlayerReady) {
458
522
  this.isPlayerReady = true;
459
523
  return true;
@@ -466,7 +530,7 @@ class VideoTrackerState {
466
530
  * Checks flags and changes state
467
531
  * @returns {boolean} True if the state changed.
468
532
  */
469
- goRequest() {
533
+ goRequest(): boolean {
470
534
  if (!this.isRequested) {
471
535
  this.isRequested = true;
472
536
 
@@ -482,7 +546,7 @@ class VideoTrackerState {
482
546
  * Checks flags and changes state
483
547
  * @returns {boolean} True if the state changed.
484
548
  */
485
- goStart() {
549
+ goStart(): boolean {
486
550
  if (this.isRequested && !this.isStarted) {
487
551
  if (this.isAd()) {
488
552
  this.numberOfAds++;
@@ -503,7 +567,7 @@ class VideoTrackerState {
503
567
  * Checks flags and changes state
504
568
  * @returns {boolean} True if the state changed.
505
569
  */
506
- goEnd() {
570
+ goEnd(): boolean {
507
571
  if (this.isRequested) {
508
572
  this.numberOfErrors = 0;
509
573
  this.resetFlags();
@@ -521,7 +585,7 @@ class VideoTrackerState {
521
585
  * Checks flags and changes state
522
586
  * @returns {boolean} True if the state changed.
523
587
  */
524
- goPause() {
588
+ goPause(): boolean {
525
589
  if (this.isStarted && !this.isPaused) {
526
590
  this.isPaused = true;
527
591
  this.isPlaying = false;
@@ -529,7 +593,7 @@ class VideoTrackerState {
529
593
  this.playtimeSinceLastEvent.stop();
530
594
  this.timeSinceResumed.reset();
531
595
  if (this.isBuffering) {
532
- this._bufferAcc += this.bufferElapsedTime.getDeltaTime();
596
+ this._bufferAcc += this.bufferElapsedTime.getDeltaTime() as number;
533
597
  }
534
598
  this.elapsedTime.start();
535
599
  return true;
@@ -542,20 +606,20 @@ class VideoTrackerState {
542
606
  * Checks flags and changes state
543
607
  * @returns {boolean} True if the state changed.
544
608
  */
545
- goResume() {
609
+ goResume(): boolean {
546
610
  if (this.isStarted && this.isPaused) {
547
611
  this.isPaused = false;
548
612
  this.isPlaying = true;
549
613
  this.timeSincePaused.stop();
550
614
  this.timeSinceResumed.start();
551
615
  if (this._hb) {
552
- this._acc = this.elapsedTime.getDeltaTime();
616
+ this._acc = this.elapsedTime.getDeltaTime() as number;
553
617
  this._hb = false;
554
618
  } else {
555
619
  if (this.isBuffering) {
556
620
  this.bufferElapsedTime.start();
557
621
  }
558
- this._acc += this.elapsedTime.getDeltaTime();
622
+ this._acc += this.elapsedTime.getDeltaTime() as number;
559
623
  }
560
624
  return true;
561
625
  } else {
@@ -567,7 +631,7 @@ class VideoTrackerState {
567
631
  * Checks flags and changes state
568
632
  * @returns {boolean} True if the state changed.
569
633
  */
570
- goBufferStart() {
634
+ goBufferStart(): boolean {
571
635
  if (this.isRequested && !this.isBuffering) {
572
636
  this.isBuffering = true;
573
637
  this.isPlaying = false;
@@ -584,16 +648,16 @@ class VideoTrackerState {
584
648
  * Checks flags and changes state
585
649
  * @returns {boolean} True if the state changed.
586
650
  */
587
- goBufferEnd() {
651
+ goBufferEnd(): boolean {
588
652
  if (this.isRequested && this.isBuffering) {
589
653
  this.isBuffering = false;
590
654
  this.isPlaying = true;
591
655
  this.timeSinceBufferBegin.stop();
592
656
  if (this._hb) {
593
- this._bufferAcc = this.bufferElapsedTime.getDeltaTime();
657
+ this._bufferAcc = this.bufferElapsedTime.getDeltaTime() as number;
594
658
  this._hb = false;
595
659
  } else {
596
- this._bufferAcc += this.bufferElapsedTime.getDeltaTime();
660
+ this._bufferAcc += this.bufferElapsedTime.getDeltaTime() as number;
597
661
  }
598
662
 
599
663
  // Accumulate total rebuffering time for content only
@@ -613,7 +677,7 @@ class VideoTrackerState {
613
677
  * Checks flags and changes state
614
678
  * @returns {boolean} True if the state changed.
615
679
  */
616
- goSeekStart() {
680
+ goSeekStart(): boolean {
617
681
  if (this.isStarted && !this.isSeeking) {
618
682
  this.isSeeking = true;
619
683
  this.isPlaying = false;
@@ -633,7 +697,7 @@ class VideoTrackerState {
633
697
  * Checks flags and changes state
634
698
  * @returns {boolean} True if the state changed.
635
699
  */
636
- goSeekEnd() {
700
+ goSeekEnd(): boolean {
637
701
  if (this.isStarted && this.isSeeking) {
638
702
  this.isSeeking = false;
639
703
  this.isPlaying = true;
@@ -654,7 +718,7 @@ class VideoTrackerState {
654
718
  * Checks flags and changes state
655
719
  * @returns {boolean} True if the state changed.
656
720
  */
657
- goAdBreakStart() {
721
+ goAdBreakStart(): boolean {
658
722
  if (!this.isAdBreak) {
659
723
  this.isAdBreak = true;
660
724
  this.timeSinceAdBreakStart.start();
@@ -668,11 +732,11 @@ class VideoTrackerState {
668
732
  * Checks flags and changes state
669
733
  * @returns {boolean} True if the state changed.
670
734
  */
671
- goAdBreakEnd() {
735
+ goAdBreakEnd(): boolean {
672
736
  if (this.isAdBreak) {
673
737
  this.isRequested = false;
674
738
  this.isAdBreak = false;
675
- this.totalAdPlaytime = this.timeSinceAdBreakStart.getDeltaTime();
739
+ this.totalAdPlaytime = this.timeSinceAdBreakStart.getDeltaTime() as number;
676
740
  this.timeSinceAdBreakStart.stop();
677
741
  return true;
678
742
  } else {
@@ -683,35 +747,35 @@ class VideoTrackerState {
683
747
  /**
684
748
  * Restarts download chrono.
685
749
  */
686
- goDownload() {
750
+ goDownload(): void {
687
751
  this.timeSinceLastDownload.start();
688
752
  }
689
753
 
690
754
  /**
691
755
  * Restarts heartbeat chrono.
692
756
  */
693
- goHeartbeat() {
757
+ goHeartbeat(): void {
694
758
  this.timeSinceLastHeartbeat.start();
695
759
  }
696
760
 
697
761
  /**
698
762
  * Restarts rendition change chrono.
699
763
  */
700
- goRenditionChange() {
764
+ goRenditionChange(): void {
701
765
  this.timeSinceLastRenditionChange.start();
702
766
  }
703
767
 
704
768
  /**
705
769
  * Restarts ad quartile chrono.
706
770
  */
707
- goAdQuartile() {
771
+ goAdQuartile(): void {
708
772
  this.timeSinceLastAdQuartile.start();
709
773
  }
710
774
 
711
775
  /**
712
776
  * Increments error counter and starts appropriate error timer.
713
777
  */
714
- goError() {
778
+ goError(): void {
715
779
  this.isError = true;
716
780
  this.numberOfErrors++;
717
781
 
@@ -734,7 +798,7 @@ class VideoTrackerState {
734
798
  /**
735
799
  * Restarts last ad chrono.
736
800
  */
737
- goLastAd() {
801
+ goLastAd(): void {
738
802
  this.timeSinceLastAd.start();
739
803
  }
740
804
 
@@ -742,7 +806,7 @@ class VideoTrackerState {
742
806
  * Updates peak bitrate and time-weighted average bitrate (content only).
743
807
  * @param {number} bitrate Current content bitrate in bps.
744
808
  */
745
- trackContentBitrateState(bitrate) {
809
+ trackContentBitrateState(bitrate: number): void {
746
810
  if (bitrate && typeof bitrate === "number") {
747
811
  this.peakBitrate = Math.max(this.peakBitrate, bitrate);
748
812
 
@@ -804,7 +868,7 @@ class VideoTrackerState {
804
868
  * Records network download bitrate observation. Only tracks values that differ from previous.
805
869
  * @param {number} bps Network throughput in bits per second.
806
870
  */
807
- trackDownloadRate(bps) {
871
+ trackDownloadRate(bps: number): void {
808
872
  if (!bps || typeof bps !== "number" || bps <= 0) return;
809
873
  if (bps !== this._lastDownloadBitrate) {
810
874
  this._downloadBitrates.push(bps);
@@ -817,7 +881,7 @@ class VideoTrackerState {
817
881
  * @param {number} height Rendition height in pixels.
818
882
  * @param {number} width Rendition width in pixels.
819
883
  */
820
- addPlayedRendition(height, width) {
884
+ addPlayedRendition(height: number, width: number): void {
821
885
  if (height && width) {
822
886
  this._playedRenditions.add(`${height}x${width}`);
823
887
  }
@@ -827,7 +891,7 @@ class VideoTrackerState {
827
891
  /**
828
892
  * Resets tracked variable for view id change
829
893
  * */
830
- resetViewIdTrackedState() {
894
+ resetViewIdTrackedState(): void {
831
895
  this.peakBitrate = 0;
832
896
  this.startupTime = null;
833
897
  this.partialAverageBitrate = 0;
@@ -844,28 +908,28 @@ class VideoTrackerState {
844
908
  }
845
909
 
846
910
  /** Methods to manage total ads time chrono */
847
- clearTotalAdsTime() {
911
+ clearTotalAdsTime(): void {
848
912
  Log.debug("clear total ads time", this.totalAdTime);
849
913
  this._totalAdPlaytime.reset();
850
914
  }
851
915
 
852
- totalAdTime() {
916
+ totalAdTime(): number {
853
917
  return this._totalAdPlaytime.getDuration();
854
918
  }
855
919
 
856
- startAdsTime() {
920
+ startAdsTime(): void {
857
921
  Log.debug("startAdsTime");
858
922
  return this._totalAdPlaytime.start();
859
923
  }
860
924
 
861
- stopAdsTime() {
925
+ stopAdsTime(): number | null {
862
926
  Log.debug("stopAdsTime");
863
927
  return this._totalAdPlaytime.stop();
864
928
  }
865
929
 
866
- setStartupTime(totalAdTime) {
930
+ setStartupTime(totalAdTime: number): void {
867
931
  if (this.startupTime === null) {
868
- this.startupTime = Math.max(this.timeSinceRequested.getDeltaTime() - totalAdTime, 0)
932
+ this.startupTime = Math.max((this.timeSinceRequested.getDeltaTime() as number) - totalAdTime, 0)
869
933
  }
870
934
  }
871
935
 
package/src/constants.js DELETED
@@ -1,63 +0,0 @@
1
- /**
2
- * Constants for the library.
3
- * @class Constants
4
- * @static
5
- */
6
- class Constants {}
7
-
8
- /**
9
- * Enum for types/positions of ads.
10
- * @example var type = Constants.AdPositions.PRE
11
- * @enum {String}
12
- */
13
- Constants.AdPositions = {
14
- /** For ads shown before the content. */
15
- PRE: "pre",
16
- /** For ads shown during the content. */
17
- MID: "mid",
18
- /** For ads shown after the content. */
19
- POST: "post",
20
- };
21
-
22
- // bam.nr-data.net
23
- //bam-cell.nr-data.net
24
-
25
- Constants.COLLECTOR = {
26
- US: ["bam.nr-data.net", "bam-cell.nr-data.net"],
27
- EU: "bam.eu01.nr-data.net",
28
- JP: "bam.jp.nr-data.net",
29
- Staging: "staging-bam-cell.nr-data.net",
30
- GOV: "gov-bam.nr-data.net",
31
- };
32
-
33
- // ====== VALID EVENT TYPES ======
34
- Constants.VALID_EVENT_TYPES = [
35
- "VideoAction",
36
- "VideoAdAction",
37
- "VideoErrorAction",
38
- "VideoCustomAction",
39
- ];
40
-
41
- Constants.MAX_PAYLOAD_SIZE = 1048576; // 1MB = 1024 × 1024 bytes
42
- Constants.MAX_BEACON_SIZE = 61440; // 60KB = 60 × 1024 bytes
43
- Constants.MAX_EVENTS_PER_BATCH = 1000;
44
- Constants.INTERVAL = 10000; //10 seconds
45
- Constants.DEFAULT_QOE_INTERVAL_FACTOR = 2;
46
-
47
- Constants.QOE_KPI_KEYS = [
48
- "startupTime", "peakBitrate", "averageBitrate", "totalPlaytime",
49
- "totalRebufferingTime", "rebufferingRatio", "hadStartupError",
50
- "hadPlaybackError", "numberOfErrors"
51
- ];
52
-
53
- Constants.QOE_AGGREGATE_KEYS = [
54
- "coreVersion", "instrumentation.name",
55
- "instrumentation.provider", "instrumentation.version", "isBackgroundEvent", "playerName", "playerVersion",
56
- "src", "viewId", "viewSession", "contentIsAutoplayed", "contentIsMuted", "contentRenditionHeight", "contentRenditionWidth",
57
- "contentSrc", "numberOfVideos", "pageUrl", "trackerName", "trackerVersion", "contentDuration", "contentPlayrate", "contentPlayhead",
58
- "contentPreload", "elapsedTime", "contentTitle", "contentId", "contentIsLive", "deviceType", "deviceGroup", "deviceManufacturer",
59
- "deviceModel", "deviceName", "deviceSize", "deviceUuid", "contentRenditionName", "contentIsFullscreen", "contentCdn",
60
- "contentFps", "asnOrganization", "asnLongitude", "asnLatitude", "asn", "timeSinceRequested", "timeSinceStarted"
61
- ]
62
-
63
- export default Constants;
File without changes
File without changes
File without changes