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.
@@ -1025,6 +1025,7 @@ function createVastAdLayer(contentVideo, options) {
1025
1025
  var adHls;
1026
1026
  var adContainerEl;
1027
1027
  var currentAd;
1028
+ var currentMediaFile;
1028
1029
  var sessionId;
1029
1030
  var destroyed = false;
1030
1031
  var tornDown = false;
@@ -1271,7 +1272,12 @@ function createVastAdLayer(contentVideo, options) {
1271
1272
  adContainerEl.style.display = "none";
1272
1273
  adContainerEl.style.pointerEvents = "none";
1273
1274
  }
1274
- emit("ad_impression");
1275
+ emit("ad_impression", {
1276
+ adId: currentAd === null || currentAd === void 0 ? void 0 : currentAd.id,
1277
+ adTitle: currentAd === null || currentAd === void 0 ? void 0 : currentAd.title,
1278
+ adUrl: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.url,
1279
+ mediaType: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.type
1280
+ });
1275
1281
  emit("content_resume");
1276
1282
  }
1277
1283
  function handleAdError() {
@@ -1293,6 +1299,7 @@ function createVastAdLayer(contentVideo, options) {
1293
1299
  adHls.destroy();
1294
1300
  adHls = void 0;
1295
1301
  }
1302
+ currentMediaFile = void 0;
1296
1303
  if (adVideoElement) {
1297
1304
  if (singleElementMode && adVideoElement === contentVideo) {
1298
1305
  contentVideo.pause();
@@ -1457,6 +1464,7 @@ function createVastAdLayer(contentVideo, options) {
1457
1464
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
1458
1465
  adVideoElement.muted = false;
1459
1466
  mediaFile2 = selectBestMediaFile(ad.mediaFiles);
1467
+ currentMediaFile = mediaFile2;
1460
1468
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
1461
1469
  startPlayback(mediaFile2);
1462
1470
  return [
@@ -1503,6 +1511,7 @@ function createVastAdLayer(contentVideo, options) {
1503
1511
  }
1504
1512
  emit("content_pause");
1505
1513
  mediaFile = selectBestMediaFile(ad.mediaFiles);
1514
+ currentMediaFile = mediaFile;
1506
1515
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile.url));
1507
1516
  startPlayback(mediaFile);
1508
1517
  return [
@@ -1668,6 +1677,7 @@ function createVastAdLayer(contentVideo, options) {
1668
1677
  ];
1669
1678
  mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1670
1679
  teardownCurrentPlayback();
1680
+ currentMediaFile = slot.mediaFile;
1671
1681
  adVideoElement = contentVideo;
1672
1682
  adHls = void 0;
1673
1683
  adPlaying = true;
@@ -1702,6 +1712,7 @@ function createVastAdLayer(contentVideo, options) {
1702
1712
  case 2:
1703
1713
  if (smartTVMode && !slot.videoEl) {
1704
1714
  teardownCurrentPlayback();
1715
+ currentMediaFile = slot.mediaFile;
1705
1716
  if (adVideoElement) {
1706
1717
  adVideoElement.remove();
1707
1718
  adVideoElement = void 0;
@@ -1733,6 +1744,7 @@ function createVastAdLayer(contentVideo, options) {
1733
1744
  ];
1734
1745
  }
1735
1746
  teardownCurrentPlayback();
1747
+ currentMediaFile = slot.mediaFile;
1736
1748
  if (adVideoElement && adVideoElement !== slot.videoEl) {
1737
1749
  adVideoElement.remove();
1738
1750
  }
@@ -1864,6 +1876,7 @@ function createVastAdLayer(contentVideo, options) {
1864
1876
  }
1865
1877
  }
1866
1878
  currentAd = void 0;
1879
+ currentMediaFile = void 0;
1867
1880
  tornDown = false;
1868
1881
  return [
1869
1882
  2
@@ -1916,6 +1929,7 @@ function createVastAdLayer(contentVideo, options) {
1916
1929
  }
1917
1930
  adContainerEl = void 0;
1918
1931
  currentAd = void 0;
1932
+ currentMediaFile = void 0;
1919
1933
  listeners.clear();
1920
1934
  },
1921
1935
  isAdPlaying: function isAdPlaying() {
@@ -3663,13 +3677,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3663
3677
  key: "attachAdLayerEventListeners",
3664
3678
  value: function attachAdLayerEventListeners() {
3665
3679
  var _this = this;
3666
- this.adLayer.on("ad_impression", function() {
3680
+ this.adLayer.on("ad_impression", function(payload) {
3667
3681
  if (_this.config.licenseKey) {
3682
+ var _ref;
3683
+ var adUrl = (_ref = payload === null || payload === void 0 ? void 0 : payload.adUrl) !== null && _ref !== void 0 ? _ref : _this.lastServedAdUrl;
3684
+ if (adUrl) {
3685
+ _this.lastServedAdUrl = adUrl;
3686
+ }
3668
3687
  sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
3669
3688
  source: _this.getAdSource(),
3670
3689
  adIndex: _this.currentAdIndex
3671
- }, _this.lastServedAdUrl ? {
3672
- adUrl: _this.lastServedAdUrl
3690
+ }, adUrl ? {
3691
+ adUrl: adUrl
3673
3692
  } : {}), {
3674
3693
  timestamp: /* @__PURE__ */ new Date().toISOString()
3675
3694
  }), _this.getAnalyticsContext());