stormcloud-video-player 0.6.9 → 0.6.10

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.
@@ -989,6 +989,7 @@ function createVastAdLayer(contentVideo, options) {
989
989
  var adHls;
990
990
  var adContainerEl;
991
991
  var currentAd;
992
+ var currentMediaFile;
992
993
  var sessionId;
993
994
  var destroyed = false;
994
995
  var tornDown = false;
@@ -1235,7 +1236,12 @@ function createVastAdLayer(contentVideo, options) {
1235
1236
  adContainerEl.style.display = "none";
1236
1237
  adContainerEl.style.pointerEvents = "none";
1237
1238
  }
1238
- emit("ad_impression");
1239
+ emit("ad_impression", {
1240
+ adId: currentAd === null || currentAd === void 0 ? void 0 : currentAd.id,
1241
+ adTitle: currentAd === null || currentAd === void 0 ? void 0 : currentAd.title,
1242
+ adUrl: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.url,
1243
+ mediaType: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.type
1244
+ });
1239
1245
  emit("content_resume");
1240
1246
  }
1241
1247
  function handleAdError() {
@@ -1257,6 +1263,7 @@ function createVastAdLayer(contentVideo, options) {
1257
1263
  adHls.destroy();
1258
1264
  adHls = void 0;
1259
1265
  }
1266
+ currentMediaFile = void 0;
1260
1267
  if (adVideoElement) {
1261
1268
  if (singleElementMode && adVideoElement === contentVideo) {
1262
1269
  contentVideo.pause();
@@ -1421,6 +1428,7 @@ function createVastAdLayer(contentVideo, options) {
1421
1428
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
1422
1429
  adVideoElement.muted = false;
1423
1430
  mediaFile2 = selectBestMediaFile(ad.mediaFiles);
1431
+ currentMediaFile = mediaFile2;
1424
1432
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
1425
1433
  startPlayback(mediaFile2);
1426
1434
  return [
@@ -1467,6 +1475,7 @@ function createVastAdLayer(contentVideo, options) {
1467
1475
  }
1468
1476
  emit("content_pause");
1469
1477
  mediaFile = selectBestMediaFile(ad.mediaFiles);
1478
+ currentMediaFile = mediaFile;
1470
1479
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile.url));
1471
1480
  startPlayback(mediaFile);
1472
1481
  return [
@@ -1632,6 +1641,7 @@ function createVastAdLayer(contentVideo, options) {
1632
1641
  ];
1633
1642
  mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1634
1643
  teardownCurrentPlayback();
1644
+ currentMediaFile = slot.mediaFile;
1635
1645
  adVideoElement = contentVideo;
1636
1646
  adHls = void 0;
1637
1647
  adPlaying = true;
@@ -1666,6 +1676,7 @@ function createVastAdLayer(contentVideo, options) {
1666
1676
  case 2:
1667
1677
  if (smartTVMode && !slot.videoEl) {
1668
1678
  teardownCurrentPlayback();
1679
+ currentMediaFile = slot.mediaFile;
1669
1680
  if (adVideoElement) {
1670
1681
  adVideoElement.remove();
1671
1682
  adVideoElement = void 0;
@@ -1697,6 +1708,7 @@ function createVastAdLayer(contentVideo, options) {
1697
1708
  ];
1698
1709
  }
1699
1710
  teardownCurrentPlayback();
1711
+ currentMediaFile = slot.mediaFile;
1700
1712
  if (adVideoElement && adVideoElement !== slot.videoEl) {
1701
1713
  adVideoElement.remove();
1702
1714
  }
@@ -1828,6 +1840,7 @@ function createVastAdLayer(contentVideo, options) {
1828
1840
  }
1829
1841
  }
1830
1842
  currentAd = void 0;
1843
+ currentMediaFile = void 0;
1831
1844
  tornDown = false;
1832
1845
  return [
1833
1846
  2
@@ -1880,6 +1893,7 @@ function createVastAdLayer(contentVideo, options) {
1880
1893
  }
1881
1894
  adContainerEl = void 0;
1882
1895
  currentAd = void 0;
1896
+ currentMediaFile = void 0;
1883
1897
  listeners.clear();
1884
1898
  },
1885
1899
  isAdPlaying: function isAdPlaying() {
@@ -3627,13 +3641,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3627
3641
  key: "attachAdLayerEventListeners",
3628
3642
  value: function attachAdLayerEventListeners() {
3629
3643
  var _this = this;
3630
- this.adLayer.on("ad_impression", function() {
3644
+ this.adLayer.on("ad_impression", function(payload) {
3631
3645
  if (_this.config.licenseKey) {
3646
+ var _ref;
3647
+ var adUrl = (_ref = payload === null || payload === void 0 ? void 0 : payload.adUrl) !== null && _ref !== void 0 ? _ref : _this.lastServedAdUrl;
3648
+ if (adUrl) {
3649
+ _this.lastServedAdUrl = adUrl;
3650
+ }
3632
3651
  sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
3633
3652
  source: _this.getAdSource(),
3634
3653
  adIndex: _this.currentAdIndex
3635
- }, _this.lastServedAdUrl ? {
3636
- adUrl: _this.lastServedAdUrl
3654
+ }, adUrl ? {
3655
+ adUrl: adUrl
3637
3656
  } : {}), {
3638
3657
  timestamp: /* @__PURE__ */ new Date().toISOString()
3639
3658
  }), _this.getAnalyticsContext());