stormcloud-video-player 0.6.5 → 0.6.7

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.
@@ -1030,6 +1030,7 @@ function createVastAdLayer(contentVideo, options) {
1030
1030
  var tornDown = false;
1031
1031
  var trackingFired = createEmptyTrackingState();
1032
1032
  var adStallTimerId;
1033
+ var savedContentVideoStyles;
1033
1034
  var currentAdEventHandlers;
1034
1035
  var preloadSlots = /* @__PURE__ */ new Map();
1035
1036
  function emit(event, payload) {
@@ -1146,7 +1147,7 @@ function createVastAdLayer(contentVideo, options) {
1146
1147
  video.style.top = "0";
1147
1148
  video.style.width = "100%";
1148
1149
  video.style.height = "100%";
1149
- video.style.objectFit = "contain";
1150
+ video.style.objectFit = "cover";
1150
1151
  video.style.backgroundColor = "#000";
1151
1152
  video.playsInline = true;
1152
1153
  video.muted = false;
@@ -1261,12 +1262,31 @@ function createVastAdLayer(contentVideo, options) {
1261
1262
  delete contentVideo.dataset.stormcloudAdPlaying;
1262
1263
  }
1263
1264
  }
1265
+ function applyContentVideoAdCoverStyles() {
1266
+ if (!singleElementMode) return;
1267
+ savedContentVideoStyles = {
1268
+ objectFit: contentVideo.style.objectFit,
1269
+ width: contentVideo.style.width,
1270
+ height: contentVideo.style.height
1271
+ };
1272
+ contentVideo.style.objectFit = "cover";
1273
+ contentVideo.style.width = "100%";
1274
+ contentVideo.style.height = "100%";
1275
+ }
1276
+ function restoreContentVideoStyles() {
1277
+ if (!singleElementMode || !savedContentVideoStyles) return;
1278
+ contentVideo.style.objectFit = savedContentVideoStyles.objectFit;
1279
+ contentVideo.style.width = savedContentVideoStyles.width;
1280
+ contentVideo.style.height = savedContentVideoStyles.height;
1281
+ savedContentVideoStyles = void 0;
1282
+ }
1264
1283
  function handleAdComplete() {
1265
1284
  if (tornDown) return;
1266
1285
  clearAdStallTimer();
1267
1286
  if (debug) console.log("".concat(LOG, " Handling ad completion"));
1268
1287
  adPlaying = false;
1269
1288
  setAdPlayingFlag(false);
1289
+ restoreContentVideoStyles();
1270
1290
  if (adContainerEl) {
1271
1291
  adContainerEl.style.display = "none";
1272
1292
  adContainerEl.style.pointerEvents = "none";
@@ -1281,6 +1301,7 @@ function createVastAdLayer(contentVideo, options) {
1281
1301
  if (debug) console.log("".concat(LOG, " Handling ad error"));
1282
1302
  adPlaying = false;
1283
1303
  setAdPlayingFlag(false);
1304
+ restoreContentVideoStyles();
1284
1305
  if (adContainerEl) {
1285
1306
  adContainerEl.style.display = "none";
1286
1307
  adContainerEl.style.pointerEvents = "none";
@@ -1451,6 +1472,7 @@ function createVastAdLayer(contentVideo, options) {
1451
1472
  ];
1452
1473
  contentVideo.style.visibility = "visible";
1453
1474
  contentVideo.style.opacity = "1";
1475
+ applyContentVideoAdCoverStyles();
1454
1476
  emit("content_pause");
1455
1477
  setupAdEventListeners();
1456
1478
  adVolume2 = originalMutedState ? 1 : originalVolume;
@@ -1689,6 +1711,7 @@ function createVastAdLayer(contentVideo, options) {
1689
1711
  ];
1690
1712
  contentVideo.style.visibility = "visible";
1691
1713
  contentVideo.style.opacity = "1";
1714
+ applyContentVideoAdCoverStyles();
1692
1715
  emit("content_pause");
1693
1716
  setupAdEventListeners();
1694
1717
  adVolume2 = originalMutedState ? 1 : originalVolume;
@@ -1839,6 +1862,7 @@ function createVastAdLayer(contentVideo, options) {
1839
1862
  if (debug) console.log("".concat(LOG, " Stopping ad"));
1840
1863
  adPlaying = false;
1841
1864
  setAdPlayingFlag(false);
1865
+ restoreContentVideoStyles();
1842
1866
  contentVideo.muted = originalMutedState;
1843
1867
  contentVideo.volume = originalMutedState ? 0 : originalVolume;
1844
1868
  contentVideo.style.visibility = "visible";
@@ -1877,6 +1901,7 @@ function createVastAdLayer(contentVideo, options) {
1877
1901
  destroyed = true;
1878
1902
  adPlaying = false;
1879
1903
  setAdPlayingFlag(false);
1904
+ restoreContentVideoStyles();
1880
1905
  contentVideo.muted = originalMutedState;
1881
1906
  contentVideo.volume = originalVolume;
1882
1907
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;