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.
@@ -2141,24 +2141,30 @@ function getBrowserID(clientInfo) {
2141
2141
  });
2142
2142
  })();
2143
2143
  }
2144
- var TRACK_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track";
2144
+ var PLAYER_TRACKING_BASE_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking";
2145
+ var TRACK_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/metrics/ingest");
2146
+ var HEARTBEAT_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/heartbeat");
2147
+ var IMPRESSIONS_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/impressions/ingest");
2148
+ function buildHeaders(licenseKey) {
2149
+ var headers = {
2150
+ "Content-Type": "application/json"
2151
+ };
2152
+ if (licenseKey) {
2153
+ headers["Authorization"] = "Bearer ".concat(licenseKey);
2154
+ }
2155
+ return headers;
2156
+ }
2145
2157
  function sendTrackRequest(licenseKey, body) {
2146
2158
  return _async_to_generator(function() {
2147
- var headers, response;
2159
+ var response;
2148
2160
  return _ts_generator(this, function(_state) {
2149
2161
  switch(_state.label){
2150
2162
  case 0:
2151
- headers = {
2152
- "Content-Type": "application/json"
2153
- };
2154
- if (licenseKey) {
2155
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2156
- }
2157
2163
  return [
2158
2164
  4,
2159
2165
  fetch(TRACK_URL, {
2160
2166
  method: "POST",
2161
- headers: headers,
2167
+ headers: buildHeaders(licenseKey),
2162
2168
  body: JSON.stringify(body)
2163
2169
  })
2164
2170
  ];
@@ -2180,14 +2186,86 @@ function sendTrackRequest(licenseKey, body) {
2180
2186
  });
2181
2187
  })();
2182
2188
  }
2183
- function sendInitialTracking(licenseKey) {
2189
+ function postJson(url, licenseKey, body) {
2184
2190
  return _async_to_generator(function() {
2185
- var clientInfo, browserId, trackingData, headers, response, error;
2191
+ var response;
2192
+ return _ts_generator(this, function(_state) {
2193
+ switch(_state.label){
2194
+ case 0:
2195
+ return [
2196
+ 4,
2197
+ fetch(url, {
2198
+ method: "POST",
2199
+ headers: buildHeaders(licenseKey),
2200
+ body: JSON.stringify(body)
2201
+ })
2202
+ ];
2203
+ case 1:
2204
+ response = _state.sent();
2205
+ if (!response.ok) {
2206
+ throw new Error("HTTP error! status: ".concat(response.status));
2207
+ }
2208
+ return [
2209
+ 4,
2210
+ response.json()
2211
+ ];
2212
+ case 2:
2213
+ _state.sent();
2214
+ return [
2215
+ 2
2216
+ ];
2217
+ }
2218
+ });
2219
+ })();
2220
+ }
2221
+ function buildPlayerMetricEvent(_0) {
2222
+ return _async_to_generator(function(licenseKey) {
2223
+ var context, flags, _flags_captureAt, clientInfo, browserId, captureAt;
2224
+ var _arguments = arguments;
2225
+ return _ts_generator(this, function(_state) {
2226
+ switch(_state.label){
2227
+ case 0:
2228
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2229
+ clientInfo = getClientInfo();
2230
+ return [
2231
+ 4,
2232
+ getBrowserID(clientInfo)
2233
+ ];
2234
+ case 1:
2235
+ browserId = _state.sent();
2236
+ captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
2237
+ return [
2238
+ 2,
2239
+ {
2240
+ player_id: browserId,
2241
+ browserId: browserId,
2242
+ device_type: clientInfo.deviceType,
2243
+ deviceType: clientInfo.deviceType,
2244
+ input_stream_type: context.inputStreamType,
2245
+ os: clientInfo.os,
2246
+ ad_loaded: flags.adLoaded,
2247
+ ad_detect: flags.adDetect,
2248
+ license_key: licenseKey,
2249
+ capture_at: captureAt,
2250
+ timestamp: captureAt
2251
+ }
2252
+ ];
2253
+ }
2254
+ });
2255
+ }).apply(this, arguments);
2256
+ }
2257
+ function sendInitialTracking(_0) {
2258
+ return _async_to_generator(function(licenseKey) {
2259
+ var context, clientInfo, browserId, trackingData, error;
2260
+ var _arguments = arguments;
2186
2261
  return _ts_generator(this, function(_state) {
2187
2262
  switch(_state.label){
2188
2263
  case 0:
2264
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
2265
+ _state.label = 1;
2266
+ case 1:
2189
2267
  _state.trys.push([
2190
- 0,
2268
+ 1,
2191
2269
  4,
2192
2270
  ,
2193
2271
  5
@@ -2197,34 +2275,29 @@ function sendInitialTracking(licenseKey) {
2197
2275
  4,
2198
2276
  getBrowserID(clientInfo)
2199
2277
  ];
2200
- case 1:
2278
+ case 2:
2201
2279
  browserId = _state.sent();
2202
2280
  trackingData = _object_spread({
2203
2281
  browserId: browserId
2204
2282
  }, clientInfo);
2205
- headers = {
2206
- "Content-Type": "application/json"
2207
- };
2208
- if (licenseKey) {
2209
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2210
- }
2211
2283
  return [
2212
2284
  4,
2213
- fetch(TRACK_URL, {
2214
- method: "POST",
2215
- headers: headers,
2216
- body: JSON.stringify(trackingData)
2285
+ sendTrackRequest(licenseKey, {
2286
+ events: [
2287
+ {
2288
+ player_id: browserId,
2289
+ device_type: clientInfo.deviceType,
2290
+ input_stream_type: context.inputStreamType,
2291
+ os: clientInfo.os,
2292
+ ad_loaded: false,
2293
+ ad_detect: false,
2294
+ license_key: licenseKey,
2295
+ capture_at: /* @__PURE__ */ new Date().toISOString()
2296
+ }
2297
+ ],
2298
+ trackingData: trackingData
2217
2299
  })
2218
2300
  ];
2219
- case 2:
2220
- response = _state.sent();
2221
- if (!response.ok) {
2222
- throw new Error("HTTP error! status: ".concat(response.status));
2223
- }
2224
- return [
2225
- 4,
2226
- response.json()
2227
- ];
2228
2301
  case 3:
2229
2302
  _state.sent();
2230
2303
  return [
@@ -2244,36 +2317,30 @@ function sendInitialTracking(licenseKey) {
2244
2317
  ];
2245
2318
  }
2246
2319
  });
2247
- })();
2320
+ }).apply(this, arguments);
2248
2321
  }
2249
- function sendAdDetectTracking(licenseKey, adDetectInfo) {
2250
- return _async_to_generator(function() {
2251
- var clientInfo, browserId, trackingData, error;
2322
+ function sendAdDetectTracking(_0, _1) {
2323
+ return _async_to_generator(function(licenseKey, adDetectInfo) {
2324
+ var context, error;
2325
+ var _arguments = arguments;
2252
2326
  return _ts_generator(this, function(_state) {
2253
2327
  switch(_state.label){
2254
2328
  case 0:
2329
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2330
+ _state.label = 1;
2331
+ case 1:
2255
2332
  _state.trys.push([
2256
- 0,
2333
+ 1,
2257
2334
  3,
2258
2335
  ,
2259
2336
  4
2260
2337
  ]);
2261
- clientInfo = getClientInfo();
2262
- return [
2263
- 4,
2264
- getBrowserID(clientInfo)
2265
- ];
2266
- case 1:
2267
- browserId = _state.sent();
2268
- trackingData = _object_spread({
2269
- browserId: browserId
2270
- }, clientInfo);
2271
2338
  return [
2272
2339
  4,
2273
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2274
- licenseKey: licenseKey,
2275
- adDetectInfo: adDetectInfo
2276
- }))
2340
+ sendHeartbeat(licenseKey, context, {
2341
+ adDetect: true,
2342
+ captureAt: adDetectInfo.timestamp
2343
+ })
2277
2344
  ];
2278
2345
  case 2:
2279
2346
  _state.sent();
@@ -2294,36 +2361,30 @@ function sendAdDetectTracking(licenseKey, adDetectInfo) {
2294
2361
  ];
2295
2362
  }
2296
2363
  });
2297
- })();
2364
+ }).apply(this, arguments);
2298
2365
  }
2299
- function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2300
- return _async_to_generator(function() {
2301
- var clientInfo, browserId, trackingData, error;
2366
+ function sendAdLoadedTracking(_0, _1) {
2367
+ return _async_to_generator(function(licenseKey, adLoadedInfo) {
2368
+ var context, error;
2369
+ var _arguments = arguments;
2302
2370
  return _ts_generator(this, function(_state) {
2303
2371
  switch(_state.label){
2304
2372
  case 0:
2373
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2374
+ _state.label = 1;
2375
+ case 1:
2305
2376
  _state.trys.push([
2306
- 0,
2377
+ 1,
2307
2378
  3,
2308
2379
  ,
2309
2380
  4
2310
2381
  ]);
2311
- clientInfo = getClientInfo();
2312
- return [
2313
- 4,
2314
- getBrowserID(clientInfo)
2315
- ];
2316
- case 1:
2317
- browserId = _state.sent();
2318
- trackingData = _object_spread({
2319
- browserId: browserId
2320
- }, clientInfo);
2321
2382
  return [
2322
2383
  4,
2323
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2324
- licenseKey: licenseKey,
2325
- adLoadedInfo: adLoadedInfo
2326
- }))
2384
+ sendHeartbeat(licenseKey, context, {
2385
+ adLoaded: true,
2386
+ captureAt: adLoadedInfo.timestamp
2387
+ })
2327
2388
  ];
2328
2389
  case 2:
2329
2390
  _state.sent();
@@ -2344,103 +2405,95 @@ function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
2344
2405
  ];
2345
2406
  }
2346
2407
  });
2347
- })();
2408
+ }).apply(this, arguments);
2348
2409
  }
2349
- function sendAdImpressionTracking(licenseKey, adImpressionInfo) {
2350
- return _async_to_generator(function() {
2351
- var clientInfo, browserId, trackingData, error;
2410
+ function sendAdImpressionTracking(_0, _1) {
2411
+ return _async_to_generator(function(licenseKey, adImpressionInfo) {
2412
+ var context, metricEvent, error;
2413
+ var _arguments = arguments;
2352
2414
  return _ts_generator(this, function(_state) {
2353
2415
  switch(_state.label){
2354
2416
  case 0:
2417
+ context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2418
+ _state.label = 1;
2419
+ case 1:
2355
2420
  _state.trys.push([
2356
- 0,
2357
- 3,
2421
+ 1,
2422
+ 4,
2358
2423
  ,
2359
- 4
2424
+ 5
2360
2425
  ]);
2361
- clientInfo = getClientInfo();
2362
2426
  return [
2363
2427
  4,
2364
- getBrowserID(clientInfo)
2428
+ buildPlayerMetricEvent(licenseKey, context, {
2429
+ captureAt: adImpressionInfo.timestamp
2430
+ })
2365
2431
  ];
2366
- case 1:
2367
- browserId = _state.sent();
2368
- trackingData = _object_spread({
2369
- browserId: browserId
2370
- }, clientInfo);
2432
+ case 2:
2433
+ metricEvent = _state.sent();
2371
2434
  return [
2372
2435
  4,
2373
- sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
2374
- licenseKey: licenseKey,
2375
- adImpressionInfo: adImpressionInfo
2376
- }))
2436
+ Promise.all([
2437
+ postJson(HEARTBEAT_URL, licenseKey, metricEvent),
2438
+ postJson(IMPRESSIONS_URL, licenseKey, {
2439
+ events: [
2440
+ {
2441
+ player_id: metricEvent.player_id,
2442
+ ad_played_count: 1,
2443
+ ad_url: adImpressionInfo.adUrl,
2444
+ license_key: licenseKey,
2445
+ capture_at: adImpressionInfo.timestamp
2446
+ }
2447
+ ]
2448
+ })
2449
+ ])
2377
2450
  ];
2378
- case 2:
2451
+ case 3:
2379
2452
  _state.sent();
2380
2453
  return [
2381
2454
  3,
2382
- 4
2455
+ 5
2383
2456
  ];
2384
- case 3:
2457
+ case 4:
2385
2458
  error = _state.sent();
2386
2459
  console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
2387
2460
  return [
2388
2461
  3,
2389
- 4
2462
+ 5
2390
2463
  ];
2391
- case 4:
2464
+ case 5:
2392
2465
  return [
2393
2466
  2
2394
2467
  ];
2395
2468
  }
2396
2469
  });
2397
- })();
2470
+ }).apply(this, arguments);
2398
2471
  }
2399
- function sendHeartbeat(licenseKey) {
2400
- return _async_to_generator(function() {
2401
- var clientInfo, browserId, heartbeatData, headers, response, error;
2472
+ function sendHeartbeat(_0) {
2473
+ return _async_to_generator(function(licenseKey) {
2474
+ var context, flags, heartbeatData, error;
2475
+ var _arguments = arguments;
2402
2476
  return _ts_generator(this, function(_state) {
2403
2477
  switch(_state.label){
2404
2478
  case 0:
2479
+ context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
2480
+ _state.label = 1;
2481
+ case 1:
2405
2482
  _state.trys.push([
2406
- 0,
2483
+ 1,
2407
2484
  4,
2408
2485
  ,
2409
2486
  5
2410
2487
  ]);
2411
- clientInfo = getClientInfo();
2412
2488
  return [
2413
2489
  4,
2414
- getBrowserID(clientInfo)
2415
- ];
2416
- case 1:
2417
- browserId = _state.sent();
2418
- heartbeatData = {
2419
- browserId: browserId,
2420
- timestamp: /* @__PURE__ */ new Date().toISOString()
2421
- };
2422
- headers = {
2423
- "Content-Type": "application/json"
2424
- };
2425
- if (licenseKey) {
2426
- headers["Authorization"] = "Bearer ".concat(licenseKey);
2427
- }
2428
- return [
2429
- 4,
2430
- fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/heartbeat", {
2431
- method: "POST",
2432
- headers: headers,
2433
- body: JSON.stringify(heartbeatData)
2434
- })
2490
+ buildPlayerMetricEvent(licenseKey, context, flags)
2435
2491
  ];
2436
2492
  case 2:
2437
- response = _state.sent();
2438
- if (!response.ok) {
2439
- throw new Error("HTTP error! status: ".concat(response.status));
2440
- }
2493
+ heartbeatData = _state.sent();
2441
2494
  return [
2442
2495
  4,
2443
- response.json()
2496
+ postJson(HEARTBEAT_URL, licenseKey, heartbeatData)
2444
2497
  ];
2445
2498
  case 3:
2446
2499
  _state.sent();
@@ -2461,7 +2514,7 @@ function sendHeartbeat(licenseKey) {
2461
2514
  ];
2462
2515
  }
2463
2516
  });
2464
- })();
2517
+ }).apply(this, arguments);
2465
2518
  }
2466
2519
  // src/utils/polyfills.ts
2467
2520
  function polyfillURLSearchParams() {
@@ -3476,17 +3529,62 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3476
3529
  return "vast";
3477
3530
  }
3478
3531
  },
3532
+ {
3533
+ key: "getInputStreamType",
3534
+ value: function getInputStreamType() {
3535
+ var src = this.config.src.toLowerCase();
3536
+ if (src.includes(".m3u8")) return "hls";
3537
+ if (src.includes(".mpd")) return "dash";
3538
+ if (src.includes(".mp4")) return "mp4";
3539
+ return this.isLiveStream ? "live" : "vod";
3540
+ }
3541
+ },
3542
+ {
3543
+ key: "getAnalyticsContext",
3544
+ value: function getAnalyticsContext() {
3545
+ return {
3546
+ inputStreamType: this.getInputStreamType()
3547
+ };
3548
+ }
3549
+ },
3550
+ {
3551
+ key: "getAdUrlFromBids",
3552
+ value: function getAdUrlFromBids(bids) {
3553
+ var _bids_;
3554
+ return bids === null || bids === void 0 ? void 0 : (_bids_ = bids[0]) === null || _bids_ === void 0 ? void 0 : _bids_.vastUrl;
3555
+ }
3556
+ },
3557
+ {
3558
+ key: "trackAdLoaded",
3559
+ value: function trackAdLoaded(bids) {
3560
+ if (!this.config.licenseKey) return;
3561
+ var adUrl = this.getAdUrlFromBids(bids);
3562
+ if (adUrl) {
3563
+ this.lastServedAdUrl = adUrl;
3564
+ }
3565
+ sendAdLoadedTracking(this.config.licenseKey, _object_spread_props(_object_spread({
3566
+ source: this.getAdSource()
3567
+ }, adUrl ? {
3568
+ vastUrl: adUrl
3569
+ } : {}), {
3570
+ timestamp: /* @__PURE__ */ new Date().toISOString()
3571
+ }), this.getAnalyticsContext());
3572
+ }
3573
+ },
3479
3574
  {
3480
3575
  key: "attachAdLayerEventListeners",
3481
3576
  value: function attachAdLayerEventListeners() {
3482
3577
  var _this = this;
3483
3578
  this.adLayer.on("ad_impression", function() {
3484
3579
  if (_this.config.licenseKey) {
3485
- sendAdImpressionTracking(_this.config.licenseKey, {
3580
+ sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
3486
3581
  source: _this.getAdSource(),
3487
- adIndex: _this.currentAdIndex,
3582
+ adIndex: _this.currentAdIndex
3583
+ }, _this.lastServedAdUrl ? {
3584
+ adUrl: _this.lastServedAdUrl
3585
+ } : {}), {
3488
3586
  timestamp: /* @__PURE__ */ new Date().toISOString()
3489
- });
3587
+ }), _this.getAnalyticsContext());
3490
3588
  }
3491
3589
  });
3492
3590
  this.adLayer.on("ad_error", function(errorPayload) {
@@ -3580,6 +3678,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3580
3678
  _this.isInAdTransition = false;
3581
3679
  if (!_this.inAdBreak) return;
3582
3680
  _this.currentAdIndex++;
3681
+ _this.trackAdLoaded();
3583
3682
  _this.adLayer.playPreloaded(token).catch(function(err) {
3584
3683
  if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playPreloaded failed:", err);
3585
3684
  _this.handleAdFailure();
@@ -3609,6 +3708,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3609
3708
  var freshBids = (_this_pendingNextAdBids = _this.pendingNextAdBids) !== null && _this_pendingNextAdBids !== void 0 ? _this_pendingNextAdBids : bids;
3610
3709
  _this.pendingNextAdBids = null;
3611
3710
  _this.currentAdIndex++;
3711
+ _this.trackAdLoaded(freshBids);
3612
3712
  _this.adLayer.playAd(freshBids).catch(function(err) {
3613
3713
  if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
3614
3714
  _this.handleAdFailure();
@@ -3988,7 +4088,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3988
4088
  }, ((_this_pendingAdBreak1 = this.pendingAdBreak) === null || _this_pendingAdBreak1 === void 0 ? void 0 : _this_pendingAdBreak1.detectedAtFragmentSn) != null && {
3989
4089
  detectedAtFragmentSn: this.pendingAdBreak.detectedAtFragmentSn
3990
4090
  });
3991
- sendAdDetectTracking(this.config.licenseKey, adDetectInfo);
4091
+ sendAdDetectTracking(this.config.licenseKey, adDetectInfo, this.getAnalyticsContext());
3992
4092
  }
3993
4093
  var isManifestMarker = this.isManifestBasedMarker(marker);
3994
4094
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
@@ -4057,6 +4157,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4057
4157
  var bids = this.pendingNextAdBids;
4058
4158
  this.pendingNextAdBids = null;
4059
4159
  this.currentAdIndex++;
4160
+ this.trackAdLoaded(bids);
4060
4161
  this.adLayer.playAd(bids).catch(function() {
4061
4162
  return _this.handleAdFailure();
4062
4163
  });
@@ -4311,7 +4412,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4311
4412
  key: "initializeTracking",
4312
4413
  value: function initializeTracking() {
4313
4414
  var _this = this;
4314
- sendInitialTracking(this.config.licenseKey).then(function() {
4415
+ sendInitialTracking(this.config.licenseKey, this.getAnalyticsContext()).then(function() {
4315
4416
  _this.heartbeatInterval = window.setInterval(function() {
4316
4417
  _this.sendHeartbeatIfNeeded();
4317
4418
  }, 5e3);
@@ -4332,7 +4433,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4332
4433
  var now = Date.now();
4333
4434
  if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
4334
4435
  this.lastHeartbeatTime = now;
4335
- sendHeartbeat(this.config.licenseKey).catch(function(error) {
4436
+ sendHeartbeat(this.config.licenseKey, this.getAnalyticsContext()).catch(function(error) {
4336
4437
  if (_this.config.debugAdTiming) {
4337
4438
  console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
4338
4439
  }
@@ -4725,12 +4826,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4725
4826
  10
4726
4827
  ];
4727
4828
  _this.currentAdIndex++;
4728
- if (_this.config.licenseKey) {
4729
- sendAdLoadedTracking(_this.config.licenseKey, {
4730
- source: _this.getAdSource(),
4731
- timestamp: /* @__PURE__ */ new Date().toISOString()
4732
- });
4733
- }
4829
+ _this.trackAdLoaded(bids1);
4734
4830
  return [
4735
4831
  4,
4736
4832
  _this.adLayer.playAd(bids1)
@@ -4835,12 +4931,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4835
4931
  ];
4836
4932
  case 18:
4837
4933
  _this.currentAdIndex++;
4838
- if (_this.config.licenseKey) {
4839
- sendAdLoadedTracking(_this.config.licenseKey, {
4840
- source: _this.getAdSource(),
4841
- timestamp: /* @__PURE__ */ new Date().toISOString()
4842
- });
4843
- }
4934
+ _this.trackAdLoaded(bids2);
4844
4935
  return [
4845
4936
  4,
4846
4937
  _this.adLayer.playAd(bids2)
@@ -4999,12 +5090,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4999
5090
  6
5000
5091
  ];
5001
5092
  this.currentAdIndex++;
5002
- if (this.config.licenseKey) {
5003
- sendAdLoadedTracking(this.config.licenseKey, {
5004
- source: this.getAdSource(),
5005
- timestamp: /* @__PURE__ */ new Date().toISOString()
5006
- });
5007
- }
5093
+ this.trackAdLoaded();
5008
5094
  _state.label = 1;
5009
5095
  case 1:
5010
5096
  _state.trys.push([
@@ -5198,12 +5284,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5198
5284
  5
5199
5285
  ];
5200
5286
  case 3:
5201
- if (this.config.licenseKey) {
5202
- sendAdLoadedTracking(this.config.licenseKey, {
5203
- source: this.getAdSource(),
5204
- timestamp: /* @__PURE__ */ new Date().toISOString()
5205
- });
5206
- }
5287
+ this.trackAdLoaded(bids);
5207
5288
  return [
5208
5289
  4,
5209
5290
  this.adLayer.playAd(bids)
@@ -5349,6 +5430,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5349
5430
  ,
5350
5431
  7
5351
5432
  ]);
5433
+ this.trackAdLoaded(bids);
5352
5434
  return [
5353
5435
  4,
5354
5436
  this.adLayer.playAd(bids)