stormcloud-video-player 0.6.8 → 0.6.9

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/lib/index.cjs CHANGED
@@ -2323,24 +2323,30 @@ function getBrowserID(clientInfo) {
2323
2323
  });
2324
2324
  })();
2325
2325
  }
2326
- var TRACK_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track";
2326
+ var PLAYER_TRACKING_BASE_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking";
2327
+ var TRACK_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/metrics/ingest");
2328
+ var HEARTBEAT_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/heartbeat");
2329
+ var IMPRESSIONS_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/impressions/ingest");
2330
+ function buildHeaders(licenseKey) {
2331
+ var headers = {
2332
+ "Content-Type": "application/json"
2333
+ };
2334
+ if (licenseKey) {
2335
+ headers["Authorization"] = "Bearer ".concat(licenseKey);
2336
+ }
2337
+ return headers;
2338
+ }
2327
2339
  function sendTrackRequest(licenseKey, body) {
2328
2340
  return _async_to_generator(function() {
2329
- var headers, response;
2341
+ var response;
2330
2342
  return _ts_generator(this, function(_state) {
2331
2343
  switch(_state.label){
2332
2344
  case 0:
2333
- headers = {
2334
- "Content-Type": "application/json"
2335
- };
2336
- if (licenseKey) {
2337
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2338
- }
2339
2345
  return [
2340
2346
  4,
2341
2347
  fetch(TRACK_URL, {
2342
2348
  method: "POST",
2343
- headers: headers,
2349
+ headers: buildHeaders(licenseKey),
2344
2350
  body: JSON.stringify(body)
2345
2351
  })
2346
2352
  ];
@@ -2362,14 +2368,86 @@ function sendTrackRequest(licenseKey, body) {
2362
2368
  });
2363
2369
  })();
2364
2370
  }
2365
- function sendInitialTracking(licenseKey) {
2371
+ function postJson(url, licenseKey, body) {
2366
2372
  return _async_to_generator(function() {
2367
- var clientInfo, browserId, trackingData, headers, response, error;
2373
+ var response;
2374
+ return _ts_generator(this, function(_state) {
2375
+ switch(_state.label){
2376
+ case 0:
2377
+ return [
2378
+ 4,
2379
+ fetch(url, {
2380
+ method: "POST",
2381
+ headers: buildHeaders(licenseKey),
2382
+ body: JSON.stringify(body)
2383
+ })
2384
+ ];
2385
+ case 1:
2386
+ response = _state.sent();
2387
+ if (!response.ok) {
2388
+ throw new Error("HTTP error! status: ".concat(response.status));
2389
+ }
2390
+ return [
2391
+ 4,
2392
+ response.json()
2393
+ ];
2394
+ case 2:
2395
+ _state.sent();
2396
+ return [
2397
+ 2
2398
+ ];
2399
+ }
2400
+ });
2401
+ })();
2402
+ }
2403
+ function buildPlayerMetricEvent(_0) {
2404
+ return _async_to_generator(function(licenseKey) {
2405
+ var context, flags, _flags_captureAt, clientInfo, browserId, captureAt;
2406
+ var _arguments = arguments;
2407
+ return _ts_generator(this, function(_state) {
2408
+ switch(_state.label){
2409
+ case 0:
2410
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2411
+ clientInfo = getClientInfo();
2412
+ return [
2413
+ 4,
2414
+ getBrowserID(clientInfo)
2415
+ ];
2416
+ case 1:
2417
+ browserId = _state.sent();
2418
+ captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
2419
+ return [
2420
+ 2,
2421
+ {
2422
+ player_id: browserId,
2423
+ browserId: browserId,
2424
+ device_type: clientInfo.deviceType,
2425
+ deviceType: clientInfo.deviceType,
2426
+ input_stream_type: context.inputStreamType,
2427
+ os: clientInfo.os,
2428
+ ad_loaded: flags.adLoaded,
2429
+ ad_detect: flags.adDetect,
2430
+ license_key: licenseKey,
2431
+ capture_at: captureAt,
2432
+ timestamp: captureAt
2433
+ }
2434
+ ];
2435
+ }
2436
+ });
2437
+ }).apply(this, arguments);
2438
+ }
2439
+ function sendInitialTracking(_0) {
2440
+ return _async_to_generator(function(licenseKey) {
2441
+ var context, clientInfo, browserId, trackingData, error;
2442
+ var _arguments = arguments;
2368
2443
  return _ts_generator(this, function(_state) {
2369
2444
  switch(_state.label){
2370
2445
  case 0:
2446
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2447
+ _state.label = 1;
2448
+ case 1:
2371
2449
  _state.trys.push([
2372
- 0,
2450
+ 1,
2373
2451
  4,
2374
2452
  ,
2375
2453
  5
@@ -2379,34 +2457,29 @@ function sendInitialTracking(licenseKey) {
2379
2457
  4,
2380
2458
  getBrowserID(clientInfo)
2381
2459
  ];
2382
- case 1:
2460
+ case 2:
2383
2461
  browserId = _state.sent();
2384
2462
  trackingData = _object_spread({
2385
2463
  browserId: browserId
2386
2464
  }, clientInfo);
2387
- headers = {
2388
- "Content-Type": "application/json"
2389
- };
2390
- if (licenseKey) {
2391
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2392
- }
2393
2465
  return [
2394
2466
  4,
2395
- fetch(TRACK_URL, {
2396
- method: "POST",
2397
- headers: headers,
2398
- body: JSON.stringify(trackingData)
2467
+ sendTrackRequest(licenseKey, {
2468
+ events: [
2469
+ {
2470
+ player_id: browserId,
2471
+ device_type: clientInfo.deviceType,
2472
+ input_stream_type: context.inputStreamType,
2473
+ os: clientInfo.os,
2474
+ ad_loaded: false,
2475
+ ad_detect: false,
2476
+ license_key: licenseKey,
2477
+ capture_at: /* @__PURE__ */ new Date().toISOString()
2478
+ }
2479
+ ],
2480
+ trackingData: trackingData
2399
2481
  })
2400
2482
  ];
2401
- case 2:
2402
- response = _state.sent();
2403
- if (!response.ok) {
2404
- throw new Error("HTTP error! status: ".concat(response.status));
2405
- }
2406
- return [
2407
- 4,
2408
- response.json()
2409
- ];
2410
2483
  case 3:
2411
2484
  _state.sent();
2412
2485
  return [
@@ -2426,36 +2499,30 @@ function sendInitialTracking(licenseKey) {
2426
2499
  ];
2427
2500
  }
2428
2501
  });
2429
- })();
2502
+ }).apply(this, arguments);
2430
2503
  }
2431
- function sendAdDetectTracking(licenseKey, adDetectInfo) {
2432
- return _async_to_generator(function() {
2433
- var clientInfo, browserId, trackingData, error;
2504
+ function sendAdDetectTracking(_0, _1) {
2505
+ return _async_to_generator(function(licenseKey, adDetectInfo) {
2506
+ var context, error;
2507
+ var _arguments = arguments;
2434
2508
  return _ts_generator(this, function(_state) {
2435
2509
  switch(_state.label){
2436
2510
  case 0:
2511
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2512
+ _state.label = 1;
2513
+ case 1:
2437
2514
  _state.trys.push([
2438
- 0,
2515
+ 1,
2439
2516
  3,
2440
2517
  ,
2441
2518
  4
2442
2519
  ]);
2443
- clientInfo = getClientInfo();
2444
- return [
2445
- 4,
2446
- getBrowserID(clientInfo)
2447
- ];
2448
- case 1:
2449
- browserId = _state.sent();
2450
- trackingData = _object_spread({
2451
- browserId: browserId
2452
- }, clientInfo);
2453
2520
  return [
2454
2521
  4,
2455
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2456
- licenseKey: licenseKey,
2457
- adDetectInfo: adDetectInfo
2458
- }))
2522
+ sendHeartbeat(licenseKey, context, {
2523
+ adDetect: true,
2524
+ captureAt: adDetectInfo.timestamp
2525
+ })
2459
2526
  ];
2460
2527
  case 2:
2461
2528
  _state.sent();
@@ -2476,36 +2543,30 @@ function sendAdDetectTracking(licenseKey, adDetectInfo) {
2476
2543
  ];
2477
2544
  }
2478
2545
  });
2479
- })();
2546
+ }).apply(this, arguments);
2480
2547
  }
2481
- function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2482
- return _async_to_generator(function() {
2483
- var clientInfo, browserId, trackingData, error;
2548
+ function sendAdLoadedTracking(_0, _1) {
2549
+ return _async_to_generator(function(licenseKey, adLoadedInfo) {
2550
+ var context, error;
2551
+ var _arguments = arguments;
2484
2552
  return _ts_generator(this, function(_state) {
2485
2553
  switch(_state.label){
2486
2554
  case 0:
2555
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2556
+ _state.label = 1;
2557
+ case 1:
2487
2558
  _state.trys.push([
2488
- 0,
2559
+ 1,
2489
2560
  3,
2490
2561
  ,
2491
2562
  4
2492
2563
  ]);
2493
- clientInfo = getClientInfo();
2494
- return [
2495
- 4,
2496
- getBrowserID(clientInfo)
2497
- ];
2498
- case 1:
2499
- browserId = _state.sent();
2500
- trackingData = _object_spread({
2501
- browserId: browserId
2502
- }, clientInfo);
2503
2564
  return [
2504
2565
  4,
2505
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2506
- licenseKey: licenseKey,
2507
- adLoadedInfo: adLoadedInfo
2508
- }))
2566
+ sendHeartbeat(licenseKey, context, {
2567
+ adLoaded: true,
2568
+ captureAt: adLoadedInfo.timestamp
2569
+ })
2509
2570
  ];
2510
2571
  case 2:
2511
2572
  _state.sent();
@@ -2526,103 +2587,95 @@ function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2526
2587
  ];
2527
2588
  }
2528
2589
  });
2529
- })();
2590
+ }).apply(this, arguments);
2530
2591
  }
2531
- function sendAdImpressionTracking(licenseKey, adImpressionInfo) {
2532
- return _async_to_generator(function() {
2533
- var clientInfo, browserId, trackingData, error;
2592
+ function sendAdImpressionTracking(_0, _1) {
2593
+ return _async_to_generator(function(licenseKey, adImpressionInfo) {
2594
+ var context, metricEvent, error;
2595
+ var _arguments = arguments;
2534
2596
  return _ts_generator(this, function(_state) {
2535
2597
  switch(_state.label){
2536
2598
  case 0:
2599
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2600
+ _state.label = 1;
2601
+ case 1:
2537
2602
  _state.trys.push([
2538
- 0,
2539
- 3,
2603
+ 1,
2604
+ 4,
2540
2605
  ,
2541
- 4
2606
+ 5
2542
2607
  ]);
2543
- clientInfo = getClientInfo();
2544
2608
  return [
2545
2609
  4,
2546
- getBrowserID(clientInfo)
2610
+ buildPlayerMetricEvent(licenseKey, context, {
2611
+ captureAt: adImpressionInfo.timestamp
2612
+ })
2547
2613
  ];
2548
- case 1:
2549
- browserId = _state.sent();
2550
- trackingData = _object_spread({
2551
- browserId: browserId
2552
- }, clientInfo);
2614
+ case 2:
2615
+ metricEvent = _state.sent();
2553
2616
  return [
2554
2617
  4,
2555
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2556
- licenseKey: licenseKey,
2557
- adImpressionInfo: adImpressionInfo
2558
- }))
2618
+ Promise.all([
2619
+ postJson(HEARTBEAT_URL, licenseKey, metricEvent),
2620
+ postJson(IMPRESSIONS_URL, licenseKey, {
2621
+ events: [
2622
+ {
2623
+ player_id: metricEvent.player_id,
2624
+ ad_played_count: 1,
2625
+ ad_url: adImpressionInfo.adUrl,
2626
+ license_key: licenseKey,
2627
+ capture_at: adImpressionInfo.timestamp
2628
+ }
2629
+ ]
2630
+ })
2631
+ ])
2559
2632
  ];
2560
- case 2:
2633
+ case 3:
2561
2634
  _state.sent();
2562
2635
  return [
2563
2636
  3,
2564
- 4
2637
+ 5
2565
2638
  ];
2566
- case 3:
2639
+ case 4:
2567
2640
  error = _state.sent();
2568
2641
  console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
2569
2642
  return [
2570
2643
  3,
2571
- 4
2644
+ 5
2572
2645
  ];
2573
- case 4:
2646
+ case 5:
2574
2647
  return [
2575
2648
  2
2576
2649
  ];
2577
2650
  }
2578
2651
  });
2579
- })();
2652
+ }).apply(this, arguments);
2580
2653
  }
2581
- function sendHeartbeat(licenseKey) {
2582
- return _async_to_generator(function() {
2583
- var clientInfo, browserId, heartbeatData, headers, response, error;
2654
+ function sendHeartbeat(_0) {
2655
+ return _async_to_generator(function(licenseKey) {
2656
+ var context, flags, heartbeatData, error;
2657
+ var _arguments = arguments;
2584
2658
  return _ts_generator(this, function(_state) {
2585
2659
  switch(_state.label){
2586
2660
  case 0:
2661
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2662
+ _state.label = 1;
2663
+ case 1:
2587
2664
  _state.trys.push([
2588
- 0,
2665
+ 1,
2589
2666
  4,
2590
2667
  ,
2591
2668
  5
2592
2669
  ]);
2593
- clientInfo = getClientInfo();
2594
2670
  return [
2595
2671
  4,
2596
- getBrowserID(clientInfo)
2597
- ];
2598
- case 1:
2599
- browserId = _state.sent();
2600
- heartbeatData = {
2601
- browserId: browserId,
2602
- timestamp: /* @__PURE__ */ new Date().toISOString()
2603
- };
2604
- headers = {
2605
- "Content-Type": "application/json"
2606
- };
2607
- if (licenseKey) {
2608
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2609
- }
2610
- return [
2611
- 4,
2612
- fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/heartbeat", {
2613
- method: "POST",
2614
- headers: headers,
2615
- body: JSON.stringify(heartbeatData)
2616
- })
2672
+ buildPlayerMetricEvent(licenseKey, context, flags)
2617
2673
  ];
2618
2674
  case 2:
2619
- response = _state.sent();
2620
- if (!response.ok) {
2621
- throw new Error("HTTP error! status: ".concat(response.status));
2622
- }
2675
+ heartbeatData = _state.sent();
2623
2676
  return [
2624
2677
  4,
2625
- response.json()
2678
+ postJson(HEARTBEAT_URL, licenseKey, heartbeatData)
2626
2679
  ];
2627
2680
  case 3:
2628
2681
  _state.sent();
@@ -2643,7 +2696,7 @@ function sendHeartbeat(licenseKey) {
2643
2696
  ];
2644
2697
  }
2645
2698
  });
2646
- })();
2699
+ }).apply(this, arguments);
2647
2700
  }
2648
2701
  // src/utils/polyfills.ts
2649
2702
  function polyfillURLSearchParams() {
@@ -3683,17 +3736,62 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3683
3736
  return "vast";
3684
3737
  }
3685
3738
  },
3739
+ {
3740
+ key: "getInputStreamType",
3741
+ value: function getInputStreamType() {
3742
+ var src = this.config.src.toLowerCase();
3743
+ if (src.includes(".m3u8")) return "hls";
3744
+ if (src.includes(".mpd")) return "dash";
3745
+ if (src.includes(".mp4")) return "mp4";
3746
+ return this.isLiveStream ? "live" : "vod";
3747
+ }
3748
+ },
3749
+ {
3750
+ key: "getAnalyticsContext",
3751
+ value: function getAnalyticsContext() {
3752
+ return {
3753
+ inputStreamType: this.getInputStreamType()
3754
+ };
3755
+ }
3756
+ },
3757
+ {
3758
+ key: "getAdUrlFromBids",
3759
+ value: function getAdUrlFromBids(bids) {
3760
+ var _bids_;
3761
+ return bids === null || bids === void 0 ? void 0 : (_bids_ = bids[0]) === null || _bids_ === void 0 ? void 0 : _bids_.vastUrl;
3762
+ }
3763
+ },
3764
+ {
3765
+ key: "trackAdLoaded",
3766
+ value: function trackAdLoaded(bids) {
3767
+ if (!this.config.licenseKey) return;
3768
+ var adUrl = this.getAdUrlFromBids(bids);
3769
+ if (adUrl) {
3770
+ this.lastServedAdUrl = adUrl;
3771
+ }
3772
+ sendAdLoadedTracking(this.config.licenseKey, _object_spread_props(_object_spread({
3773
+ source: this.getAdSource()
3774
+ }, adUrl ? {
3775
+ vastUrl: adUrl
3776
+ } : {}), {
3777
+ timestamp: /* @__PURE__ */ new Date().toISOString()
3778
+ }), this.getAnalyticsContext());
3779
+ }
3780
+ },
3686
3781
  {
3687
3782
  key: "attachAdLayerEventListeners",
3688
3783
  value: function attachAdLayerEventListeners() {
3689
3784
  var _this = this;
3690
3785
  this.adLayer.on("ad_impression", function() {
3691
3786
  if (_this.config.licenseKey) {
3692
- sendAdImpressionTracking(_this.config.licenseKey, {
3787
+ sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
3693
3788
  source: _this.getAdSource(),
3694
- adIndex: _this.currentAdIndex,
3789
+ adIndex: _this.currentAdIndex
3790
+ }, _this.lastServedAdUrl ? {
3791
+ adUrl: _this.lastServedAdUrl
3792
+ } : {}), {
3695
3793
  timestamp: /* @__PURE__ */ new Date().toISOString()
3696
- });
3794
+ }), _this.getAnalyticsContext());
3697
3795
  }
3698
3796
  });
3699
3797
  this.adLayer.on("ad_error", function(errorPayload) {
@@ -3787,6 +3885,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3787
3885
  _this.isInAdTransition = false;
3788
3886
  if (!_this.inAdBreak) return;
3789
3887
  _this.currentAdIndex++;
3888
+ _this.trackAdLoaded();
3790
3889
  _this.adLayer.playPreloaded(token).catch(function(err) {
3791
3890
  if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playPreloaded failed:", err);
3792
3891
  _this.handleAdFailure();
@@ -3816,6 +3915,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3816
3915
  var freshBids = (_this_pendingNextAdBids = _this.pendingNextAdBids) !== null && _this_pendingNextAdBids !== void 0 ? _this_pendingNextAdBids : bids;
3817
3916
  _this.pendingNextAdBids = null;
3818
3917
  _this.currentAdIndex++;
3918
+ _this.trackAdLoaded(freshBids);
3819
3919
  _this.adLayer.playAd(freshBids).catch(function(err) {
3820
3920
  if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
3821
3921
  _this.handleAdFailure();
@@ -4195,7 +4295,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4195
4295
  }, ((_this_pendingAdBreak1 = this.pendingAdBreak) === null || _this_pendingAdBreak1 === void 0 ? void 0 : _this_pendingAdBreak1.detectedAtFragmentSn) != null && {
4196
4296
  detectedAtFragmentSn: this.pendingAdBreak.detectedAtFragmentSn
4197
4297
  });
4198
- sendAdDetectTracking(this.config.licenseKey, adDetectInfo);
4298
+ sendAdDetectTracking(this.config.licenseKey, adDetectInfo, this.getAnalyticsContext());
4199
4299
  }
4200
4300
  var isManifestMarker = this.isManifestBasedMarker(marker);
4201
4301
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
@@ -4264,6 +4364,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4264
4364
  var bids = this.pendingNextAdBids;
4265
4365
  this.pendingNextAdBids = null;
4266
4366
  this.currentAdIndex++;
4367
+ this.trackAdLoaded(bids);
4267
4368
  this.adLayer.playAd(bids).catch(function() {
4268
4369
  return _this.handleAdFailure();
4269
4370
  });
@@ -4518,7 +4619,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4518
4619
  key: "initializeTracking",
4519
4620
  value: function initializeTracking() {
4520
4621
  var _this = this;
4521
- sendInitialTracking(this.config.licenseKey).then(function() {
4622
+ sendInitialTracking(this.config.licenseKey, this.getAnalyticsContext()).then(function() {
4522
4623
  _this.heartbeatInterval = window.setInterval(function() {
4523
4624
  _this.sendHeartbeatIfNeeded();
4524
4625
  }, 5e3);
@@ -4539,7 +4640,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4539
4640
  var now = Date.now();
4540
4641
  if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
4541
4642
  this.lastHeartbeatTime = now;
4542
- sendHeartbeat(this.config.licenseKey).catch(function(error) {
4643
+ sendHeartbeat(this.config.licenseKey, this.getAnalyticsContext()).catch(function(error) {
4543
4644
  if (_this.config.debugAdTiming) {
4544
4645
  console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
4545
4646
  }
@@ -4932,12 +5033,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4932
5033
  10
4933
5034
  ];
4934
5035
  _this.currentAdIndex++;
4935
- if (_this.config.licenseKey) {
4936
- sendAdLoadedTracking(_this.config.licenseKey, {
4937
- source: _this.getAdSource(),
4938
- timestamp: /* @__PURE__ */ new Date().toISOString()
4939
- });
4940
- }
5036
+ _this.trackAdLoaded(bids1);
4941
5037
  return [
4942
5038
  4,
4943
5039
  _this.adLayer.playAd(bids1)
@@ -5042,12 +5138,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5042
5138
  ];
5043
5139
  case 18:
5044
5140
  _this.currentAdIndex++;
5045
- if (_this.config.licenseKey) {
5046
- sendAdLoadedTracking(_this.config.licenseKey, {
5047
- source: _this.getAdSource(),
5048
- timestamp: /* @__PURE__ */ new Date().toISOString()
5049
- });
5050
- }
5141
+ _this.trackAdLoaded(bids2);
5051
5142
  return [
5052
5143
  4,
5053
5144
  _this.adLayer.playAd(bids2)
@@ -5206,12 +5297,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5206
5297
  6
5207
5298
  ];
5208
5299
  this.currentAdIndex++;
5209
- if (this.config.licenseKey) {
5210
- sendAdLoadedTracking(this.config.licenseKey, {
5211
- source: this.getAdSource(),
5212
- timestamp: /* @__PURE__ */ new Date().toISOString()
5213
- });
5214
- }
5300
+ this.trackAdLoaded();
5215
5301
  _state.label = 1;
5216
5302
  case 1:
5217
5303
  _state.trys.push([
@@ -5405,12 +5491,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5405
5491
  5
5406
5492
  ];
5407
5493
  case 3:
5408
- if (this.config.licenseKey) {
5409
- sendAdLoadedTracking(this.config.licenseKey, {
5410
- source: this.getAdSource(),
5411
- timestamp: /* @__PURE__ */ new Date().toISOString()
5412
- });
5413
- }
5494
+ this.trackAdLoaded(bids);
5414
5495
  return [
5415
5496
  4,
5416
5497
  this.adLayer.playAd(bids)
@@ -5556,6 +5637,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5556
5637
  ,
5557
5638
  7
5558
5639
  ]);
5640
+ this.trackAdLoaded(bids);
5559
5641
  return [
5560
5642
  4,
5561
5643
  this.adLayer.playAd(bids)