stormcloud-video-player 0.6.5 → 0.7.0

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.
@@ -619,6 +619,7 @@ function createVastAdLayer(contentVideo, options) {
619
619
  var tornDown = false;
620
620
  var trackingFired = createEmptyTrackingState();
621
621
  var adStallTimerId;
622
+ var savedContentVideoStyles;
622
623
  var currentAdEventHandlers;
623
624
  var preloadSlots = /* @__PURE__ */ new Map();
624
625
  function emit(event, payload) {
@@ -735,7 +736,7 @@ function createVastAdLayer(contentVideo, options) {
735
736
  video.style.top = "0";
736
737
  video.style.width = "100%";
737
738
  video.style.height = "100%";
738
- video.style.objectFit = "contain";
739
+ video.style.objectFit = "cover";
739
740
  video.style.backgroundColor = "#000";
740
741
  video.playsInline = true;
741
742
  video.muted = false;
@@ -850,12 +851,31 @@ function createVastAdLayer(contentVideo, options) {
850
851
  delete contentVideo.dataset.stormcloudAdPlaying;
851
852
  }
852
853
  }
854
+ function applyContentVideoAdCoverStyles() {
855
+ if (!singleElementMode) return;
856
+ savedContentVideoStyles = {
857
+ objectFit: contentVideo.style.objectFit,
858
+ width: contentVideo.style.width,
859
+ height: contentVideo.style.height
860
+ };
861
+ contentVideo.style.objectFit = "cover";
862
+ contentVideo.style.width = "100%";
863
+ contentVideo.style.height = "100%";
864
+ }
865
+ function restoreContentVideoStyles() {
866
+ if (!singleElementMode || !savedContentVideoStyles) return;
867
+ contentVideo.style.objectFit = savedContentVideoStyles.objectFit;
868
+ contentVideo.style.width = savedContentVideoStyles.width;
869
+ contentVideo.style.height = savedContentVideoStyles.height;
870
+ savedContentVideoStyles = void 0;
871
+ }
853
872
  function handleAdComplete() {
854
873
  if (tornDown) return;
855
874
  clearAdStallTimer();
856
875
  if (debug) console.log("".concat(LOG, " Handling ad completion"));
857
876
  adPlaying = false;
858
877
  setAdPlayingFlag(false);
878
+ restoreContentVideoStyles();
859
879
  if (adContainerEl) {
860
880
  adContainerEl.style.display = "none";
861
881
  adContainerEl.style.pointerEvents = "none";
@@ -870,6 +890,7 @@ function createVastAdLayer(contentVideo, options) {
870
890
  if (debug) console.log("".concat(LOG, " Handling ad error"));
871
891
  adPlaying = false;
872
892
  setAdPlayingFlag(false);
893
+ restoreContentVideoStyles();
873
894
  if (adContainerEl) {
874
895
  adContainerEl.style.display = "none";
875
896
  adContainerEl.style.pointerEvents = "none";
@@ -1040,6 +1061,7 @@ function createVastAdLayer(contentVideo, options) {
1040
1061
  ];
1041
1062
  contentVideo.style.visibility = "visible";
1042
1063
  contentVideo.style.opacity = "1";
1064
+ applyContentVideoAdCoverStyles();
1043
1065
  emit("content_pause");
1044
1066
  setupAdEventListeners();
1045
1067
  adVolume2 = originalMutedState ? 1 : originalVolume;
@@ -1278,6 +1300,7 @@ function createVastAdLayer(contentVideo, options) {
1278
1300
  ];
1279
1301
  contentVideo.style.visibility = "visible";
1280
1302
  contentVideo.style.opacity = "1";
1303
+ applyContentVideoAdCoverStyles();
1281
1304
  emit("content_pause");
1282
1305
  setupAdEventListeners();
1283
1306
  adVolume2 = originalMutedState ? 1 : originalVolume;
@@ -1428,6 +1451,7 @@ function createVastAdLayer(contentVideo, options) {
1428
1451
  if (debug) console.log("".concat(LOG, " Stopping ad"));
1429
1452
  adPlaying = false;
1430
1453
  setAdPlayingFlag(false);
1454
+ restoreContentVideoStyles();
1431
1455
  contentVideo.muted = originalMutedState;
1432
1456
  contentVideo.volume = originalMutedState ? 0 : originalVolume;
1433
1457
  contentVideo.style.visibility = "visible";
@@ -1466,6 +1490,7 @@ function createVastAdLayer(contentVideo, options) {
1466
1490
  destroyed = true;
1467
1491
  adPlaying = false;
1468
1492
  setAdPlayingFlag(false);
1493
+ restoreContentVideoStyles();
1469
1494
  contentVideo.muted = originalMutedState;
1470
1495
  contentVideo.volume = originalVolume;
1471
1496
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;