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.
@@ -937,6 +937,7 @@ function createVastAdLayer(contentVideo, options) {
937
937
  var adHls;
938
938
  var adContainerEl;
939
939
  var currentAd;
940
+ var currentMediaFile;
940
941
  var sessionId;
941
942
  var destroyed = false;
942
943
  var tornDown = false;
@@ -1183,7 +1184,12 @@ function createVastAdLayer(contentVideo, options) {
1183
1184
  adContainerEl.style.display = "none";
1184
1185
  adContainerEl.style.pointerEvents = "none";
1185
1186
  }
1186
- emit("ad_impression");
1187
+ emit("ad_impression", {
1188
+ adId: currentAd === null || currentAd === void 0 ? void 0 : currentAd.id,
1189
+ adTitle: currentAd === null || currentAd === void 0 ? void 0 : currentAd.title,
1190
+ adUrl: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.url,
1191
+ mediaType: currentMediaFile === null || currentMediaFile === void 0 ? void 0 : currentMediaFile.type
1192
+ });
1187
1193
  emit("content_resume");
1188
1194
  }
1189
1195
  function handleAdError() {
@@ -1205,6 +1211,7 @@ function createVastAdLayer(contentVideo, options) {
1205
1211
  adHls.destroy();
1206
1212
  adHls = void 0;
1207
1213
  }
1214
+ currentMediaFile = void 0;
1208
1215
  if (adVideoElement) {
1209
1216
  if (singleElementMode && adVideoElement === contentVideo) {
1210
1217
  contentVideo.pause();
@@ -1369,6 +1376,7 @@ function createVastAdLayer(contentVideo, options) {
1369
1376
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume2));
1370
1377
  adVideoElement.muted = false;
1371
1378
  mediaFile2 = selectBestMediaFile(ad.mediaFiles);
1379
+ currentMediaFile = mediaFile2;
1372
1380
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile2.url));
1373
1381
  startPlayback(mediaFile2);
1374
1382
  return [
@@ -1415,6 +1423,7 @@ function createVastAdLayer(contentVideo, options) {
1415
1423
  }
1416
1424
  emit("content_pause");
1417
1425
  mediaFile = selectBestMediaFile(ad.mediaFiles);
1426
+ currentMediaFile = mediaFile;
1418
1427
  if (debug) console.log("".concat(LOG, " Loading ad from: ").concat(mediaFile.url));
1419
1428
  startPlayback(mediaFile);
1420
1429
  return [
@@ -1580,6 +1589,7 @@ function createVastAdLayer(contentVideo, options) {
1580
1589
  ];
1581
1590
  mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1582
1591
  teardownCurrentPlayback();
1592
+ currentMediaFile = slot.mediaFile;
1583
1593
  adVideoElement = contentVideo;
1584
1594
  adHls = void 0;
1585
1595
  adPlaying = true;
@@ -1614,6 +1624,7 @@ function createVastAdLayer(contentVideo, options) {
1614
1624
  case 2:
1615
1625
  if (smartTVMode && !slot.videoEl) {
1616
1626
  teardownCurrentPlayback();
1627
+ currentMediaFile = slot.mediaFile;
1617
1628
  if (adVideoElement) {
1618
1629
  adVideoElement.remove();
1619
1630
  adVideoElement = void 0;
@@ -1645,6 +1656,7 @@ function createVastAdLayer(contentVideo, options) {
1645
1656
  ];
1646
1657
  }
1647
1658
  teardownCurrentPlayback();
1659
+ currentMediaFile = slot.mediaFile;
1648
1660
  if (adVideoElement && adVideoElement !== slot.videoEl) {
1649
1661
  adVideoElement.remove();
1650
1662
  }
@@ -1776,6 +1788,7 @@ function createVastAdLayer(contentVideo, options) {
1776
1788
  }
1777
1789
  }
1778
1790
  currentAd = void 0;
1791
+ currentMediaFile = void 0;
1779
1792
  tornDown = false;
1780
1793
  return [
1781
1794
  2
@@ -1828,6 +1841,7 @@ function createVastAdLayer(contentVideo, options) {
1828
1841
  }
1829
1842
  adContainerEl = void 0;
1830
1843
  currentAd = void 0;
1844
+ currentMediaFile = void 0;
1831
1845
  listeners.clear();
1832
1846
  },
1833
1847
  isAdPlaying: function isAdPlaying() {
@@ -3575,13 +3589,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3575
3589
  key: "attachAdLayerEventListeners",
3576
3590
  value: function attachAdLayerEventListeners() {
3577
3591
  var _this = this;
3578
- this.adLayer.on("ad_impression", function() {
3592
+ this.adLayer.on("ad_impression", function(payload) {
3579
3593
  if (_this.config.licenseKey) {
3594
+ var _ref;
3595
+ var adUrl = (_ref = payload === null || payload === void 0 ? void 0 : payload.adUrl) !== null && _ref !== void 0 ? _ref : _this.lastServedAdUrl;
3596
+ if (adUrl) {
3597
+ _this.lastServedAdUrl = adUrl;
3598
+ }
3580
3599
  sendAdImpressionTracking(_this.config.licenseKey, _object_spread_props(_object_spread({
3581
3600
  source: _this.getAdSource(),
3582
3601
  adIndex: _this.currentAdIndex
3583
- }, _this.lastServedAdUrl ? {
3584
- adUrl: _this.lastServedAdUrl
3602
+ }, adUrl ? {
3603
+ adUrl: adUrl
3585
3604
  } : {}), {
3586
3605
  timestamp: /* @__PURE__ */ new Date().toISOString()
3587
3606
  }), _this.getAnalyticsContext());