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.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +47 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +47 -9
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +47 -9
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +47 -9
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +47 -9
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/vastAdLayer.cjs +34 -1
- package/lib/sdk/vastAdLayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +47 -9
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -942,6 +942,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
942
942
|
var tornDown = false;
|
|
943
943
|
var trackingFired = createEmptyTrackingState();
|
|
944
944
|
var adStallTimerId;
|
|
945
|
+
var savedContentVideoStyles;
|
|
945
946
|
var currentAdEventHandlers;
|
|
946
947
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
947
948
|
function emit(event, payload) {
|
|
@@ -1015,6 +1016,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1015
1016
|
} else if (debug) {
|
|
1016
1017
|
console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
|
|
1017
1018
|
}
|
|
1019
|
+
} else {
|
|
1020
|
+
var mp4Only1 = candidates.filter(function(f) {
|
|
1021
|
+
return !isHlsMediaFile(f);
|
|
1022
|
+
});
|
|
1023
|
+
if (mp4Only1.length > 0) {
|
|
1024
|
+
candidates = mp4Only1;
|
|
1025
|
+
if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
|
|
1026
|
+
}
|
|
1018
1027
|
}
|
|
1019
1028
|
var firstFile = candidates[0];
|
|
1020
1029
|
if (candidates.length === 1) return firstFile;
|
|
@@ -1050,7 +1059,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1050
1059
|
video.style.top = "0";
|
|
1051
1060
|
video.style.width = "100%";
|
|
1052
1061
|
video.style.height = "100%";
|
|
1053
|
-
video.style.objectFit = "
|
|
1062
|
+
video.style.objectFit = "cover";
|
|
1054
1063
|
video.style.backgroundColor = "#000";
|
|
1055
1064
|
video.playsInline = true;
|
|
1056
1065
|
video.muted = false;
|
|
@@ -1165,12 +1174,31 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1165
1174
|
delete contentVideo.dataset.stormcloudAdPlaying;
|
|
1166
1175
|
}
|
|
1167
1176
|
}
|
|
1177
|
+
function applyContentVideoAdCoverStyles() {
|
|
1178
|
+
if (!singleElementMode) return;
|
|
1179
|
+
savedContentVideoStyles = {
|
|
1180
|
+
objectFit: contentVideo.style.objectFit,
|
|
1181
|
+
width: contentVideo.style.width,
|
|
1182
|
+
height: contentVideo.style.height
|
|
1183
|
+
};
|
|
1184
|
+
contentVideo.style.objectFit = "cover";
|
|
1185
|
+
contentVideo.style.width = "100%";
|
|
1186
|
+
contentVideo.style.height = "100%";
|
|
1187
|
+
}
|
|
1188
|
+
function restoreContentVideoStyles() {
|
|
1189
|
+
if (!singleElementMode || !savedContentVideoStyles) return;
|
|
1190
|
+
contentVideo.style.objectFit = savedContentVideoStyles.objectFit;
|
|
1191
|
+
contentVideo.style.width = savedContentVideoStyles.width;
|
|
1192
|
+
contentVideo.style.height = savedContentVideoStyles.height;
|
|
1193
|
+
savedContentVideoStyles = void 0;
|
|
1194
|
+
}
|
|
1168
1195
|
function handleAdComplete() {
|
|
1169
1196
|
if (tornDown) return;
|
|
1170
1197
|
clearAdStallTimer();
|
|
1171
1198
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1172
1199
|
adPlaying = false;
|
|
1173
1200
|
setAdPlayingFlag(false);
|
|
1201
|
+
restoreContentVideoStyles();
|
|
1174
1202
|
if (adContainerEl) {
|
|
1175
1203
|
adContainerEl.style.display = "none";
|
|
1176
1204
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1185,6 +1213,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1185
1213
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1186
1214
|
adPlaying = false;
|
|
1187
1215
|
setAdPlayingFlag(false);
|
|
1216
|
+
restoreContentVideoStyles();
|
|
1188
1217
|
if (adContainerEl) {
|
|
1189
1218
|
adContainerEl.style.display = "none";
|
|
1190
1219
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1355,6 +1384,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1355
1384
|
];
|
|
1356
1385
|
contentVideo.style.visibility = "visible";
|
|
1357
1386
|
contentVideo.style.opacity = "1";
|
|
1387
|
+
applyContentVideoAdCoverStyles();
|
|
1358
1388
|
emit("content_pause");
|
|
1359
1389
|
setupAdEventListeners();
|
|
1360
1390
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1593,6 +1623,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1593
1623
|
];
|
|
1594
1624
|
contentVideo.style.visibility = "visible";
|
|
1595
1625
|
contentVideo.style.opacity = "1";
|
|
1626
|
+
applyContentVideoAdCoverStyles();
|
|
1596
1627
|
emit("content_pause");
|
|
1597
1628
|
setupAdEventListeners();
|
|
1598
1629
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1743,6 +1774,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1743
1774
|
if (debug) console.log("".concat(LOG, " Stopping ad"));
|
|
1744
1775
|
adPlaying = false;
|
|
1745
1776
|
setAdPlayingFlag(false);
|
|
1777
|
+
restoreContentVideoStyles();
|
|
1746
1778
|
contentVideo.muted = originalMutedState;
|
|
1747
1779
|
contentVideo.volume = originalMutedState ? 0 : originalVolume;
|
|
1748
1780
|
contentVideo.style.visibility = "visible";
|
|
@@ -1781,6 +1813,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1781
1813
|
destroyed = true;
|
|
1782
1814
|
adPlaying = false;
|
|
1783
1815
|
setAdPlayingFlag(false);
|
|
1816
|
+
restoreContentVideoStyles();
|
|
1784
1817
|
contentVideo.muted = originalMutedState;
|
|
1785
1818
|
contentVideo.volume = originalVolume;
|
|
1786
1819
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -3950,12 +3983,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3950
3983
|
}
|
|
3951
3984
|
}
|
|
3952
3985
|
if (this.inAdBreak) {
|
|
3953
|
-
if (
|
|
3954
|
-
|
|
3955
|
-
if (this.
|
|
3956
|
-
|
|
3986
|
+
if (marker.durationSeconds != null) {
|
|
3987
|
+
var newDurationMs = marker.durationSeconds * 1e3;
|
|
3988
|
+
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
3989
|
+
this.expectedAdBreakDurationMs = newDurationMs;
|
|
3990
|
+
var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
|
|
3991
|
+
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
3992
|
+
this.scheduleAdStopCountdown(remainingMs);
|
|
3993
|
+
if (this.config.debugAdTiming) {
|
|
3994
|
+
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
|
|
3995
|
+
}
|
|
3957
3996
|
}
|
|
3958
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
3959
3997
|
}
|
|
3960
3998
|
return;
|
|
3961
3999
|
}
|
|
@@ -4036,9 +4074,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4036
4074
|
this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
|
|
4037
4075
|
}
|
|
4038
4076
|
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4039
|
-
var
|
|
4040
|
-
var
|
|
4041
|
-
this.scheduleAdStopCountdown(
|
|
4077
|
+
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
4078
|
+
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
4079
|
+
this.scheduleAdStopCountdown(remainingMs1);
|
|
4042
4080
|
}
|
|
4043
4081
|
if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
|
|
4044
4082
|
var bids = this.pendingNextAdBids;
|