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.
@@ -975,6 +975,7 @@ function createVastAdLayer(contentVideo, options) {
975
975
  var adHls;
976
976
  var adContainerEl;
977
977
  var currentAd;
978
+ var currentMediaFile;
978
979
  var sessionId;
979
980
  var destroyed = false;
980
981
  var tornDown = false;
@@ -1221,7 +1222,12 @@ function createVastAdLayer(contentVideo, options) {
1221
1222
  adContainerEl.style.display = "none";
1222
1223
  adContainerEl.style.pointerEvents = "none";
1223
1224
  }
1224
- emit("ad_impression");
1225
+ emit("ad_impression", {
1226
+ adId: currentAd === null || currentAd === void 0 ? void 0 : currentAd.id,
1227
+ adTitle: currentAd === null || currentAd === void 0 ? void 0 : currentAd.title,
1228
+ adUrl: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.url,
1229
+ mediaType: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.type
1230
+ });
1225
1231
  emit("content_resume");
1226
1232
  }
1227
1233
  function handleAdError() {
@@ -1243,6 +1249,7 @@ function createVastAdLayer(contentVideo, options) {
1243
1249
  adHls.destroy();
1244
1250
  adHls = void 0;
1245
1251
  }
1252
+ currentMediaFile = void 0;
1246
1253
  if (adVideoElement) {
1247
1254
  if (singleElementMode && adVideoElement === contentVideo) {
1248
1255
  contentVideo.pause();
@@ -1407,6 +1414,7 @@ function createVastAdLayer(contentVideo, options) {
1407
1414
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
1408
1415
  adVideoElement.muted = false;
1409
1416
  mediaFile2 = selectBestMediaFile(ad.mediaFiles);
1417
+ currentMediaFile = mediaFile2;
1410
1418
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
1411
1419
  startPlayback(mediaFile2);
1412
1420
  return [
@@ -1453,6 +1461,7 @@ function createVastAdLayer(contentVideo, options) {
1453
1461
  }
1454
1462
  emit("content_pause");
1455
1463
  mediaFile = selectBestMediaFile(ad.mediaFiles);
1464
+ currentMediaFile = mediaFile;
1456
1465
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile.url));
1457
1466
  startPlayback(mediaFile);
1458
1467
  return [
@@ -1618,6 +1627,7 @@ function createVastAdLayer(contentVideo, options) {
1618
1627
  ];
1619
1628
  mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1620
1629
  teardownCurrentPlayback();
1630
+ currentMediaFile = slot.mediaFile;
1621
1631
  adVideoElement = contentVideo;
1622
1632
  adHls = void 0;
1623
1633
  adPlaying = true;
@@ -1652,6 +1662,7 @@ function createVastAdLayer(contentVideo, options) {
1652
1662
  case 2:
1653
1663
  if (smartTVMode && !slot.videoEl) {
1654
1664
  teardownCurrentPlayback();
1665
+ currentMediaFile = slot.mediaFile;
1655
1666
  if (adVideoElement) {
1656
1667
  adVideoElement.remove();
1657
1668
  adVideoElement = void 0;
@@ -1683,6 +1694,7 @@ function createVastAdLayer(contentVideo, options) {
1683
1694
  ];
1684
1695
  }
1685
1696
  teardownCurrentPlayback();
1697
+ currentMediaFile = slot.mediaFile;
1686
1698
  if (adVideoElement && adVideoElement !== slot.videoEl) {
1687
1699
  adVideoElement.remove();
1688
1700
  }
@@ -1814,6 +1826,7 @@ function createVastAdLayer(contentVideo, options) {
1814
1826
  }
1815
1827
  }
1816
1828
  currentAd = void 0;
1829
+ currentMediaFile = void 0;
1817
1830
  tornDown = false;
1818
1831
  return [
1819
1832
  2
@@ -1866,6 +1879,7 @@ function createVastAdLayer(contentVideo, options) {
1866
1879
  }
1867
1880
  adContainerEl = void 0;
1868
1881
  currentAd = void 0;
1882
+ currentMediaFile = void 0;
1869
1883
  listeners.clear();
1870
1884
  },
1871
1885
  isAdPlaying: function isAdPlaying() {
@@ -3613,13 +3627,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3613
3627
  key: "attachAdLayerEventListeners",
3614
3628
  value: function attachAdLayerEventListeners() {
3615
3629
  var _this = this;
3616
- this.adLayer.on("ad_impression", function() {
3630
+ this.adLayer.on("ad_impression", function(payload) {
3617
3631
  if (_this.config.licenseKey) {
3632
+ var _ref;
3633
+ var adUrl = (_ref = payload === null || payload === void 0 ? void 0 : payload.adUrl) !== null && _ref !== void 0 ? _ref : _this.lastServedAdUrl;
3634
+ if (adUrl) {
3635
+ _this.lastServedAdUrl = adUrl;
3636
+ }
3618
3637
  sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
3619
3638
  source: _this.getAdSource(),
3620
3639
  adIndex: _this.currentAdIndex
3621
- }, _this.lastServedAdUrl ? {
3622
- adUrl: _this.lastServedAdUrl
3640
+ }, adUrl ? {
3641
+ adUrl: adUrl
3623
3642
  } : {}), {
3624
3643
  timestamp: /* @__PURE__ */ new Date().toISOString()
3625
3644
  }), _this.getAnalyticsContext());