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.js CHANGED
@@ -2163,24 +2163,30 @@ function getBrowserID(clientInfo) {
2163
2163
  });
2164
2164
  })();
2165
2165
  }
2166
- var TRACK_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track";
2166
+ var PLAYER_TRACKING_BASE_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking";
2167
+ var TRACK_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/metrics/ingest");
2168
+ var HEARTBEAT_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/heartbeat");
2169
+ var IMPRESSIONS_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/impressions/ingest");
2170
+ function buildHeaders(licenseKey) {
2171
+ var headers = {
2172
+ "Content-Type": "application/json"
2173
+ };
2174
+ if (licenseKey) {
2175
+ headers["Authorization"] = "Bearer ".concat(licenseKey);
2176
+ }
2177
+ return headers;
2178
+ }
2167
2179
  function sendTrackRequest(licenseKey, body) {
2168
2180
  return _async_to_generator(function() {
2169
- var headers, response;
2181
+ var response;
2170
2182
  return _ts_generator(this, function(_state) {
2171
2183
  switch(_state.label){
2172
2184
  case 0:
2173
- headers = {
2174
- "Content-Type": "application/json"
2175
- };
2176
- if (licenseKey) {
2177
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2178
- }
2179
2185
  return [
2180
2186
  4,
2181
2187
  fetch(TRACK_URL, {
2182
2188
  method: "POST",
2183
- headers: headers,
2189
+ headers: buildHeaders(licenseKey),
2184
2190
  body: JSON.stringify(body)
2185
2191
  })
2186
2192
  ];
@@ -2202,14 +2208,86 @@ function sendTrackRequest(licenseKey, body) {
2202
2208
  });
2203
2209
  })();
2204
2210
  }
2205
- function sendInitialTracking(licenseKey) {
2211
+ function postJson(url, licenseKey, body) {
2206
2212
  return _async_to_generator(function() {
2207
- var clientInfo, browserId, trackingData, headers, response, error;
2213
+ var response;
2214
+ return _ts_generator(this, function(_state) {
2215
+ switch(_state.label){
2216
+ case 0:
2217
+ return [
2218
+ 4,
2219
+ fetch(url, {
2220
+ method: "POST",
2221
+ headers: buildHeaders(licenseKey),
2222
+ body: JSON.stringify(body)
2223
+ })
2224
+ ];
2225
+ case 1:
2226
+ response = _state.sent();
2227
+ if (!response.ok) {
2228
+ throw new Error("HTTP error! status: ".concat(response.status));
2229
+ }
2230
+ return [
2231
+ 4,
2232
+ response.json()
2233
+ ];
2234
+ case 2:
2235
+ _state.sent();
2236
+ return [
2237
+ 2
2238
+ ];
2239
+ }
2240
+ });
2241
+ })();
2242
+ }
2243
+ function buildPlayerMetricEvent(_0) {
2244
+ return _async_to_generator(function(licenseKey) {
2245
+ var context, flags, _flags_captureAt, clientInfo, browserId, captureAt;
2246
+ var _arguments = arguments;
2247
+ return _ts_generator(this, function(_state) {
2248
+ switch(_state.label){
2249
+ case 0:
2250
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2251
+ clientInfo = getClientInfo();
2252
+ return [
2253
+ 4,
2254
+ getBrowserID(clientInfo)
2255
+ ];
2256
+ case 1:
2257
+ browserId = _state.sent();
2258
+ captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
2259
+ return [
2260
+ 2,
2261
+ {
2262
+ player_id: browserId,
2263
+ browserId: browserId,
2264
+ device_type: clientInfo.deviceType,
2265
+ deviceType: clientInfo.deviceType,
2266
+ input_stream_type: context.inputStreamType,
2267
+ os: clientInfo.os,
2268
+ ad_loaded: flags.adLoaded,
2269
+ ad_detect: flags.adDetect,
2270
+ license_key: licenseKey,
2271
+ capture_at: captureAt,
2272
+ timestamp: captureAt
2273
+ }
2274
+ ];
2275
+ }
2276
+ });
2277
+ }).apply(this, arguments);
2278
+ }
2279
+ function sendInitialTracking(_0) {
2280
+ return _async_to_generator(function(licenseKey) {
2281
+ var context, clientInfo, browserId, trackingData, error;
2282
+ var _arguments = arguments;
2208
2283
  return _ts_generator(this, function(_state) {
2209
2284
  switch(_state.label){
2210
2285
  case 0:
2286
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2287
+ _state.label = 1;
2288
+ case 1:
2211
2289
  _state.trys.push([
2212
- 0,
2290
+ 1,
2213
2291
  4,
2214
2292
  ,
2215
2293
  5
@@ -2219,34 +2297,29 @@ function sendInitialTracking(licenseKey) {
2219
2297
  4,
2220
2298
  getBrowserID(clientInfo)
2221
2299
  ];
2222
- case 1:
2300
+ case 2:
2223
2301
  browserId = _state.sent();
2224
2302
  trackingData = _object_spread({
2225
2303
  browserId: browserId
2226
2304
  }, clientInfo);
2227
- headers = {
2228
- "Content-Type": "application/json"
2229
- };
2230
- if (licenseKey) {
2231
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2232
- }
2233
2305
  return [
2234
2306
  4,
2235
- fetch(TRACK_URL, {
2236
- method: "POST",
2237
- headers: headers,
2238
- body: JSON.stringify(trackingData)
2307
+ sendTrackRequest(licenseKey, {
2308
+ events: [
2309
+ {
2310
+ player_id: browserId,
2311
+ device_type: clientInfo.deviceType,
2312
+ input_stream_type: context.inputStreamType,
2313
+ os: clientInfo.os,
2314
+ ad_loaded: false,
2315
+ ad_detect: false,
2316
+ license_key: licenseKey,
2317
+ capture_at: /* @__PURE__ */ new Date().toISOString()
2318
+ }
2319
+ ],
2320
+ trackingData: trackingData
2239
2321
  })
2240
2322
  ];
2241
- case 2:
2242
- response = _state.sent();
2243
- if (!response.ok) {
2244
- throw new Error("HTTP error! status: ".concat(response.status));
2245
- }
2246
- return [
2247
- 4,
2248
- response.json()
2249
- ];
2250
2323
  case 3:
2251
2324
  _state.sent();
2252
2325
  return [
@@ -2266,36 +2339,30 @@ function sendInitialTracking(licenseKey) {
2266
2339
  ];
2267
2340
  }
2268
2341
  });
2269
- })();
2342
+ }).apply(this, arguments);
2270
2343
  }
2271
- function sendAdDetectTracking(licenseKey, adDetectInfo) {
2272
- return _async_to_generator(function() {
2273
- var clientInfo, browserId, trackingData, error;
2344
+ function sendAdDetectTracking(_0, _1) {
2345
+ return _async_to_generator(function(licenseKey, adDetectInfo) {
2346
+ var context, error;
2347
+ var _arguments = arguments;
2274
2348
  return _ts_generator(this, function(_state) {
2275
2349
  switch(_state.label){
2276
2350
  case 0:
2351
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2352
+ _state.label = 1;
2353
+ case 1:
2277
2354
  _state.trys.push([
2278
- 0,
2355
+ 1,
2279
2356
  3,
2280
2357
  ,
2281
2358
  4
2282
2359
  ]);
2283
- clientInfo = getClientInfo();
2284
- return [
2285
- 4,
2286
- getBrowserID(clientInfo)
2287
- ];
2288
- case 1:
2289
- browserId = _state.sent();
2290
- trackingData = _object_spread({
2291
- browserId: browserId
2292
- }, clientInfo);
2293
2360
  return [
2294
2361
  4,
2295
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2296
- licenseKey: licenseKey,
2297
- adDetectInfo: adDetectInfo
2298
- }))
2362
+ sendHeartbeat(licenseKey, context, {
2363
+ adDetect: true,
2364
+ captureAt: adDetectInfo.timestamp
2365
+ })
2299
2366
  ];
2300
2367
  case 2:
2301
2368
  _state.sent();
@@ -2316,36 +2383,30 @@ function sendAdDetectTracking(licenseKey, adDetectInfo) {
2316
2383
  ];
2317
2384
  }
2318
2385
  });
2319
- })();
2386
+ }).apply(this, arguments);
2320
2387
  }
2321
- function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2322
- return _async_to_generator(function() {
2323
- var clientInfo, browserId, trackingData, error;
2388
+ function sendAdLoadedTracking(_0, _1) {
2389
+ return _async_to_generator(function(licenseKey, adLoadedInfo) {
2390
+ var context, error;
2391
+ var _arguments = arguments;
2324
2392
  return _ts_generator(this, function(_state) {
2325
2393
  switch(_state.label){
2326
2394
  case 0:
2395
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2396
+ _state.label = 1;
2397
+ case 1:
2327
2398
  _state.trys.push([
2328
- 0,
2399
+ 1,
2329
2400
  3,
2330
2401
  ,
2331
2402
  4
2332
2403
  ]);
2333
- clientInfo = getClientInfo();
2334
- return [
2335
- 4,
2336
- getBrowserID(clientInfo)
2337
- ];
2338
- case 1:
2339
- browserId = _state.sent();
2340
- trackingData = _object_spread({
2341
- browserId: browserId
2342
- }, clientInfo);
2343
2404
  return [
2344
2405
  4,
2345
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2346
- licenseKey: licenseKey,
2347
- adLoadedInfo: adLoadedInfo
2348
- }))
2406
+ sendHeartbeat(licenseKey, context, {
2407
+ adLoaded: true,
2408
+ captureAt: adLoadedInfo.timestamp
2409
+ })
2349
2410
  ];
2350
2411
  case 2:
2351
2412
  _state.sent();
@@ -2366,103 +2427,95 @@ function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2366
2427
  ];
2367
2428
  }
2368
2429
  });
2369
- })();
2430
+ }).apply(this, arguments);
2370
2431
  }
2371
- function sendAdImpressionTracking(licenseKey, adImpressionInfo) {
2372
- return _async_to_generator(function() {
2373
- var clientInfo, browserId, trackingData, error;
2432
+ function sendAdImpressionTracking(_0, _1) {
2433
+ return _async_to_generator(function(licenseKey, adImpressionInfo) {
2434
+ var context, metricEvent, error;
2435
+ var _arguments = arguments;
2374
2436
  return _ts_generator(this, function(_state) {
2375
2437
  switch(_state.label){
2376
2438
  case 0:
2439
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2440
+ _state.label = 1;
2441
+ case 1:
2377
2442
  _state.trys.push([
2378
- 0,
2379
- 3,
2443
+ 1,
2444
+ 4,
2380
2445
  ,
2381
- 4
2446
+ 5
2382
2447
  ]);
2383
- clientInfo = getClientInfo();
2384
2448
  return [
2385
2449
  4,
2386
- getBrowserID(clientInfo)
2450
+ buildPlayerMetricEvent(licenseKey, context, {
2451
+ captureAt: adImpressionInfo.timestamp
2452
+ })
2387
2453
  ];
2388
- case 1:
2389
- browserId = _state.sent();
2390
- trackingData = _object_spread({
2391
- browserId: browserId
2392
- }, clientInfo);
2454
+ case 2:
2455
+ metricEvent = _state.sent();
2393
2456
  return [
2394
2457
  4,
2395
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2396
- licenseKey: licenseKey,
2397
- adImpressionInfo: adImpressionInfo
2398
- }))
2458
+ Promise.all([
2459
+ postJson(HEARTBEAT_URL, licenseKey, metricEvent),
2460
+ postJson(IMPRESSIONS_URL, licenseKey, {
2461
+ events: [
2462
+ {
2463
+ player_id: metricEvent.player_id,
2464
+ ad_played_count: 1,
2465
+ ad_url: adImpressionInfo.adUrl,
2466
+ license_key: licenseKey,
2467
+ capture_at: adImpressionInfo.timestamp
2468
+ }
2469
+ ]
2470
+ })
2471
+ ])
2399
2472
  ];
2400
- case 2:
2473
+ case 3:
2401
2474
  _state.sent();
2402
2475
  return [
2403
2476
  3,
2404
- 4
2477
+ 5
2405
2478
  ];
2406
- case 3:
2479
+ case 4:
2407
2480
  error = _state.sent();
2408
2481
  console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
2409
2482
  return [
2410
2483
  3,
2411
- 4
2484
+ 5
2412
2485
  ];
2413
- case 4:
2486
+ case 5:
2414
2487
  return [
2415
2488
  2
2416
2489
  ];
2417
2490
  }
2418
2491
  });
2419
- })();
2492
+ }).apply(this, arguments);
2420
2493
  }
2421
- function sendHeartbeat(licenseKey) {
2422
- return _async_to_generator(function() {
2423
- var clientInfo, browserId, heartbeatData, headers, response, error;
2494
+ function sendHeartbeat(_0) {
2495
+ return _async_to_generator(function(licenseKey) {
2496
+ var context, flags, heartbeatData, error;
2497
+ var _arguments = arguments;
2424
2498
  return _ts_generator(this, function(_state) {
2425
2499
  switch(_state.label){
2426
2500
  case 0:
2501
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2502
+ _state.label = 1;
2503
+ case 1:
2427
2504
  _state.trys.push([
2428
- 0,
2505
+ 1,
2429
2506
  4,
2430
2507
  ,
2431
2508
  5
2432
2509
  ]);
2433
- clientInfo = getClientInfo();
2434
2510
  return [
2435
2511
  4,
2436
- getBrowserID(clientInfo)
2437
- ];
2438
- case 1:
2439
- browserId = _state.sent();
2440
- heartbeatData = {
2441
- browserId: browserId,
2442
- timestamp: /* @__PURE__ */ new Date().toISOString()
2443
- };
2444
- headers = {
2445
- "Content-Type": "application/json"
2446
- };
2447
- if (licenseKey) {
2448
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2449
- }
2450
- return [
2451
- 4,
2452
- fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/heartbeat", {
2453
- method: "POST",
2454
- headers: headers,
2455
- body: JSON.stringify(heartbeatData)
2456
- })
2512
+ buildPlayerMetricEvent(licenseKey, context, flags)
2457
2513
  ];
2458
2514
  case 2:
2459
- response = _state.sent();
2460
- if (!response.ok) {
2461
- throw new Error("HTTP error! status: ".concat(response.status));
2462
- }
2515
+ heartbeatData = _state.sent();
2463
2516
  return [
2464
2517
  4,
2465
- response.json()
2518
+ postJson(HEARTBEAT_URL, licenseKey, heartbeatData)
2466
2519
  ];
2467
2520
  case 3:
2468
2521
  _state.sent();
@@ -2483,7 +2536,7 @@ function sendHeartbeat(licenseKey) {
2483
2536
  ];
2484
2537
  }
2485
2538
  });
2486
- })();
2539
+ }).apply(this, arguments);
2487
2540
  }
2488
2541
  // src/utils/polyfills.ts
2489
2542
  function polyfillURLSearchParams() {
@@ -3526,17 +3579,62 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3526
3579
  return "vast";
3527
3580
  }
3528
3581
  },
3582
+ {
3583
+ key: "getInputStreamType",
3584
+ value: function getInputStreamType() {
3585
+ var src = this.config.src.toLowerCase();
3586
+ if (src.includes(".m3u8")) return "hls";
3587
+ if (src.includes(".mpd")) return "dash";
3588
+ if (src.includes(".mp4")) return "mp4";
3589
+ return this.isLiveStream ? "live" : "vod";
3590
+ }
3591
+ },
3592
+ {
3593
+ key: "getAnalyticsContext",
3594
+ value: function getAnalyticsContext() {
3595
+ return {
3596
+ inputStreamType: this.getInputStreamType()
3597
+ };
3598
+ }
3599
+ },
3600
+ {
3601
+ key: "getAdUrlFromBids",
3602
+ value: function getAdUrlFromBids(bids) {
3603
+ var _bids_;
3604
+ return bids === null || bids === void 0 ? void 0 : (_bids_ = bids[0]) === null || _bids_ === void 0 ? void 0 : _bids_.vastUrl;
3605
+ }
3606
+ },
3607
+ {
3608
+ key: "trackAdLoaded",
3609
+ value: function trackAdLoaded(bids) {
3610
+ if (!this.config.licenseKey) return;
3611
+ var adUrl = this.getAdUrlFromBids(bids);
3612
+ if (adUrl) {
3613
+ this.lastServedAdUrl = adUrl;
3614
+ }
3615
+ sendAdLoadedTracking(this.config.licenseKey, _object_spread_props(_object_spread({
3616
+ source: this.getAdSource()
3617
+ }, adUrl ? {
3618
+ vastUrl: adUrl
3619
+ } : {}), {
3620
+ timestamp: /* @__PURE__ */ new Date().toISOString()
3621
+ }), this.getAnalyticsContext());
3622
+ }
3623
+ },
3529
3624
  {
3530
3625
  key: "attachAdLayerEventListeners",
3531
3626
  value: function attachAdLayerEventListeners() {
3532
3627
  var _this = this;
3533
3628
  this.adLayer.on("ad_impression", function() {
3534
3629
  if (_this.config.licenseKey) {
3535
- sendAdImpressionTracking(_this.config.licenseKey, {
3630
+ sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
3536
3631
  source: _this.getAdSource(),
3537
- adIndex: _this.currentAdIndex,
3632
+ adIndex: _this.currentAdIndex
3633
+ }, _this.lastServedAdUrl ? {
3634
+ adUrl: _this.lastServedAdUrl
3635
+ } : {}), {
3538
3636
  timestamp: /* @__PURE__ */ new Date().toISOString()
3539
- });
3637
+ }), _this.getAnalyticsContext());
3540
3638
  }
3541
3639
  });
3542
3640
  this.adLayer.on("ad_error", function(errorPayload) {
@@ -3630,6 +3728,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3630
3728
  _this.isInAdTransition = false;
3631
3729
  if (!_this.inAdBreak) return;
3632
3730
  _this.currentAdIndex++;
3731
+ _this.trackAdLoaded();
3633
3732
  _this.adLayer.playPreloaded(token).catch(function(err) {
3634
3733
  if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playPreloaded failed:", err);
3635
3734
  _this.handleAdFailure();
@@ -3659,6 +3758,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3659
3758
  var freshBids = (_this_pendingNextAdBids = _this.pendingNextAdBids) !== null && _this_pendingNextAdBids !== void 0 ? _this_pendingNextAdBids : bids;
3660
3759
  _this.pendingNextAdBids = null;
3661
3760
  _this.currentAdIndex++;
3761
+ _this.trackAdLoaded(freshBids);
3662
3762
  _this.adLayer.playAd(freshBids).catch(function(err) {
3663
3763
  if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
3664
3764
  _this.handleAdFailure();
@@ -4038,7 +4138,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4038
4138
  }, ((_this_pendingAdBreak1 = this.pendingAdBreak) === null || _this_pendingAdBreak1 === void 0 ? void 0 : _this_pendingAdBreak1.detectedAtFragmentSn) != null && {
4039
4139
  detectedAtFragmentSn: this.pendingAdBreak.detectedAtFragmentSn
4040
4140
  });
4041
- sendAdDetectTracking(this.config.licenseKey, adDetectInfo);
4141
+ sendAdDetectTracking(this.config.licenseKey, adDetectInfo, this.getAnalyticsContext());
4042
4142
  }
4043
4143
  var isManifestMarker = this.isManifestBasedMarker(marker);
4044
4144
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
@@ -4107,6 +4207,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4107
4207
  var bids = this.pendingNextAdBids;
4108
4208
  this.pendingNextAdBids = null;
4109
4209
  this.currentAdIndex++;
4210
+ this.trackAdLoaded(bids);
4110
4211
  this.adLayer.playAd(bids).catch(function() {
4111
4212
  return _this.handleAdFailure();
4112
4213
  });
@@ -4361,7 +4462,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4361
4462
  key: "initializeTracking",
4362
4463
  value: function initializeTracking() {
4363
4464
  var _this = this;
4364
- sendInitialTracking(this.config.licenseKey).then(function() {
4465
+ sendInitialTracking(this.config.licenseKey, this.getAnalyticsContext()).then(function() {
4365
4466
  _this.heartbeatInterval = window.setInterval(function() {
4366
4467
  _this.sendHeartbeatIfNeeded();
4367
4468
  }, 5e3);
@@ -4382,7 +4483,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4382
4483
  var now = Date.now();
4383
4484
  if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
4384
4485
  this.lastHeartbeatTime = now;
4385
- sendHeartbeat(this.config.licenseKey).catch(function(error) {
4486
+ sendHeartbeat(this.config.licenseKey, this.getAnalyticsContext()).catch(function(error) {
4386
4487
  if (_this.config.debugAdTiming) {
4387
4488
  console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
4388
4489
  }
@@ -4775,12 +4876,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4775
4876
  10
4776
4877
  ];
4777
4878
  _this.currentAdIndex++;
4778
- if (_this.config.licenseKey) {
4779
- sendAdLoadedTracking(_this.config.licenseKey, {
4780
- source: _this.getAdSource(),
4781
- timestamp: /* @__PURE__ */ new Date().toISOString()
4782
- });
4783
- }
4879
+ _this.trackAdLoaded(bids1);
4784
4880
  return [
4785
4881
  4,
4786
4882
  _this.adLayer.playAd(bids1)
@@ -4885,12 +4981,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4885
4981
  ];
4886
4982
  case 18:
4887
4983
  _this.currentAdIndex++;
4888
- if (_this.config.licenseKey) {
4889
- sendAdLoadedTracking(_this.config.licenseKey, {
4890
- source: _this.getAdSource(),
4891
- timestamp: /* @__PURE__ */ new Date().toISOString()
4892
- });
4893
- }
4984
+ _this.trackAdLoaded(bids2);
4894
4985
  return [
4895
4986
  4,
4896
4987
  _this.adLayer.playAd(bids2)
@@ -5049,12 +5140,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5049
5140
  6
5050
5141
  ];
5051
5142
  this.currentAdIndex++;
5052
- if (this.config.licenseKey) {
5053
- sendAdLoadedTracking(this.config.licenseKey, {
5054
- source: this.getAdSource(),
5055
- timestamp: /* @__PURE__ */ new Date().toISOString()
5056
- });
5057
- }
5143
+ this.trackAdLoaded();
5058
5144
  _state.label = 1;
5059
5145
  case 1:
5060
5146
  _state.trys.push([
@@ -5248,12 +5334,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5248
5334
  5
5249
5335
  ];
5250
5336
  case 3:
5251
- if (this.config.licenseKey) {
5252
- sendAdLoadedTracking(this.config.licenseKey, {
5253
- source: this.getAdSource(),
5254
- timestamp: /* @__PURE__ */ new Date().toISOString()
5255
- });
5256
- }
5337
+ this.trackAdLoaded(bids);
5257
5338
  return [
5258
5339
  4,
5259
5340
  this.adLayer.playAd(bids)
@@ -5399,6 +5480,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5399
5480
  ,
5400
5481
  7
5401
5482
  ]);
5483
+ this.trackAdLoaded(bids);
5402
5484
  return [
5403
5485
  4,
5404
5486
  this.adLayer.playAd(bids)