stormcloud-video-player 0.6.4 → 0.6.6

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) {
@@ -692,6 +693,14 @@ function createVastAdLayer(contentVideo, options) {
692
693
  } else if (debug) {
693
694
  console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
694
695
  }
696
+ } else {
697
+ var mp4Only1 = candidates.filter(function(f) {
698
+ return !isHlsMediaFile(f);
699
+ });
700
+ if (mp4Only1.length > 0) {
701
+ candidates = mp4Only1;
702
+ if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
703
+ }
695
704
  }
696
705
  var firstFile = candidates[0];
697
706
  if (candidates.length === 1) return firstFile;
@@ -727,7 +736,7 @@ function createVastAdLayer(contentVideo, options) {
727
736
  video.style.top = "0";
728
737
  video.style.width = "100%";
729
738
  video.style.height = "100%";
730
- video.style.objectFit = "contain";
739
+ video.style.objectFit = "cover";
731
740
  video.style.backgroundColor = "#000";
732
741
  video.playsInline = true;
733
742
  video.muted = false;
@@ -842,12 +851,31 @@ function createVastAdLayer(contentVideo, options) {
842
851
  delete contentVideo.dataset.stormcloudAdPlaying;
843
852
  }
844
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
+ }
845
872
  function handleAdComplete() {
846
873
  if (tornDown) return;
847
874
  clearAdStallTimer();
848
875
  if (debug) console.log("".concat(LOG, " Handling ad completion"));
849
876
  adPlaying = false;
850
877
  setAdPlayingFlag(false);
878
+ restoreContentVideoStyles();
851
879
  if (adContainerEl) {
852
880
  adContainerEl.style.display = "none";
853
881
  adContainerEl.style.pointerEvents = "none";
@@ -862,6 +890,7 @@ function createVastAdLayer(contentVideo, options) {
862
890
  if (debug) console.log("".concat(LOG, " Handling ad error"));
863
891
  adPlaying = false;
864
892
  setAdPlayingFlag(false);
893
+ restoreContentVideoStyles();
865
894
  if (adContainerEl) {
866
895
  adContainerEl.style.display = "none";
867
896
  adContainerEl.style.pointerEvents = "none";
@@ -1032,6 +1061,7 @@ function createVastAdLayer(contentVideo, options) {
1032
1061
  ];
1033
1062
  contentVideo.style.visibility = "visible";
1034
1063
  contentVideo.style.opacity = "1";
1064
+ applyContentVideoAdCoverStyles();
1035
1065
  emit("content_pause");
1036
1066
  setupAdEventListeners();
1037
1067
  adVolume2 = originalMutedState ? 1 : originalVolume;
@@ -1270,6 +1300,7 @@ function createVastAdLayer(contentVideo, options) {
1270
1300
  ];
1271
1301
  contentVideo.style.visibility = "visible";
1272
1302
  contentVideo.style.opacity = "1";
1303
+ applyContentVideoAdCoverStyles();
1273
1304
  emit("content_pause");
1274
1305
  setupAdEventListeners();
1275
1306
  adVolume2 = originalMutedState ? 1 : originalVolume;
@@ -1420,6 +1451,7 @@ function createVastAdLayer(contentVideo, options) {
1420
1451
  if (debug) console.log("".concat(LOG, " Stopping ad"));
1421
1452
  adPlaying = false;
1422
1453
  setAdPlayingFlag(false);
1454
+ restoreContentVideoStyles();
1423
1455
  contentVideo.muted = originalMutedState;
1424
1456
  contentVideo.volume = originalMutedState ? 0 : originalVolume;
1425
1457
  contentVideo.style.visibility = "visible";
@@ -1458,6 +1490,7 @@ function createVastAdLayer(contentVideo, options) {
1458
1490
  destroyed = true;
1459
1491
  adPlaying = false;
1460
1492
  setAdPlayingFlag(false);
1493
+ restoreContentVideoStyles();
1461
1494
  contentVideo.muted = originalMutedState;
1462
1495
  contentVideo.volume = originalVolume;
1463
1496
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;