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
package/lib/index.js
CHANGED
|
@@ -964,6 +964,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
964
964
|
var tornDown = false;
|
|
965
965
|
var trackingFired = createEmptyTrackingState();
|
|
966
966
|
var adStallTimerId;
|
|
967
|
+
var savedContentVideoStyles;
|
|
967
968
|
var currentAdEventHandlers;
|
|
968
969
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
969
970
|
function emit(event, payload) {
|
|
@@ -1037,6 +1038,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1037
1038
|
} else if (debug) {
|
|
1038
1039
|
console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
|
|
1039
1040
|
}
|
|
1041
|
+
} else {
|
|
1042
|
+
var mp4Only1 = candidates.filter(function(f) {
|
|
1043
|
+
return !isHlsMediaFile(f);
|
|
1044
|
+
});
|
|
1045
|
+
if (mp4Only1.length > 0) {
|
|
1046
|
+
candidates = mp4Only1;
|
|
1047
|
+
if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
|
|
1048
|
+
}
|
|
1040
1049
|
}
|
|
1041
1050
|
var firstFile = candidates[0];
|
|
1042
1051
|
if (candidates.length === 1) return firstFile;
|
|
@@ -1072,7 +1081,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1072
1081
|
video.style.top = "0";
|
|
1073
1082
|
video.style.width = "100%";
|
|
1074
1083
|
video.style.height = "100%";
|
|
1075
|
-
video.style.objectFit = "
|
|
1084
|
+
video.style.objectFit = "cover";
|
|
1076
1085
|
video.style.backgroundColor = "#000";
|
|
1077
1086
|
video.playsInline = true;
|
|
1078
1087
|
video.muted = false;
|
|
@@ -1187,12 +1196,31 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1187
1196
|
delete contentVideo.dataset.stormcloudAdPlaying;
|
|
1188
1197
|
}
|
|
1189
1198
|
}
|
|
1199
|
+
function applyContentVideoAdCoverStyles() {
|
|
1200
|
+
if (!singleElementMode) return;
|
|
1201
|
+
savedContentVideoStyles = {
|
|
1202
|
+
objectFit: contentVideo.style.objectFit,
|
|
1203
|
+
width: contentVideo.style.width,
|
|
1204
|
+
height: contentVideo.style.height
|
|
1205
|
+
};
|
|
1206
|
+
contentVideo.style.objectFit = "cover";
|
|
1207
|
+
contentVideo.style.width = "100%";
|
|
1208
|
+
contentVideo.style.height = "100%";
|
|
1209
|
+
}
|
|
1210
|
+
function restoreContentVideoStyles() {
|
|
1211
|
+
if (!singleElementMode || !savedContentVideoStyles) return;
|
|
1212
|
+
contentVideo.style.objectFit = savedContentVideoStyles.objectFit;
|
|
1213
|
+
contentVideo.style.width = savedContentVideoStyles.width;
|
|
1214
|
+
contentVideo.style.height = savedContentVideoStyles.height;
|
|
1215
|
+
savedContentVideoStyles = void 0;
|
|
1216
|
+
}
|
|
1190
1217
|
function handleAdComplete() {
|
|
1191
1218
|
if (tornDown) return;
|
|
1192
1219
|
clearAdStallTimer();
|
|
1193
1220
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1194
1221
|
adPlaying = false;
|
|
1195
1222
|
setAdPlayingFlag(false);
|
|
1223
|
+
restoreContentVideoStyles();
|
|
1196
1224
|
if (adContainerEl) {
|
|
1197
1225
|
adContainerEl.style.display = "none";
|
|
1198
1226
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1207,6 +1235,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1207
1235
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1208
1236
|
adPlaying = false;
|
|
1209
1237
|
setAdPlayingFlag(false);
|
|
1238
|
+
restoreContentVideoStyles();
|
|
1210
1239
|
if (adContainerEl) {
|
|
1211
1240
|
adContainerEl.style.display = "none";
|
|
1212
1241
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1377,6 +1406,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1377
1406
|
];
|
|
1378
1407
|
contentVideo.style.visibility = "visible";
|
|
1379
1408
|
contentVideo.style.opacity = "1";
|
|
1409
|
+
applyContentVideoAdCoverStyles();
|
|
1380
1410
|
emit("content_pause");
|
|
1381
1411
|
setupAdEventListeners();
|
|
1382
1412
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1615,6 +1645,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1615
1645
|
];
|
|
1616
1646
|
contentVideo.style.visibility = "visible";
|
|
1617
1647
|
contentVideo.style.opacity = "1";
|
|
1648
|
+
applyContentVideoAdCoverStyles();
|
|
1618
1649
|
emit("content_pause");
|
|
1619
1650
|
setupAdEventListeners();
|
|
1620
1651
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1765,6 +1796,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1765
1796
|
if (debug) console.log("".concat(LOG, " Stopping ad"));
|
|
1766
1797
|
adPlaying = false;
|
|
1767
1798
|
setAdPlayingFlag(false);
|
|
1799
|
+
restoreContentVideoStyles();
|
|
1768
1800
|
contentVideo.muted = originalMutedState;
|
|
1769
1801
|
contentVideo.volume = originalMutedState ? 0 : originalVolume;
|
|
1770
1802
|
contentVideo.style.visibility = "visible";
|
|
@@ -1803,6 +1835,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1803
1835
|
destroyed = true;
|
|
1804
1836
|
adPlaying = false;
|
|
1805
1837
|
setAdPlayingFlag(false);
|
|
1838
|
+
restoreContentVideoStyles();
|
|
1806
1839
|
contentVideo.muted = originalMutedState;
|
|
1807
1840
|
contentVideo.volume = originalVolume;
|
|
1808
1841
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -4000,12 +4033,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4000
4033
|
}
|
|
4001
4034
|
}
|
|
4002
4035
|
if (this.inAdBreak) {
|
|
4003
|
-
if (
|
|
4004
|
-
|
|
4005
|
-
if (this.
|
|
4006
|
-
|
|
4036
|
+
if (marker.durationSeconds != null) {
|
|
4037
|
+
var newDurationMs = marker.durationSeconds * 1e3;
|
|
4038
|
+
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
4039
|
+
this.expectedAdBreakDurationMs = newDurationMs;
|
|
4040
|
+
var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
|
|
4041
|
+
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
4042
|
+
this.scheduleAdStopCountdown(remainingMs);
|
|
4043
|
+
if (this.config.debugAdTiming) {
|
|
4044
|
+
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
|
|
4045
|
+
}
|
|
4007
4046
|
}
|
|
4008
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4009
4047
|
}
|
|
4010
4048
|
return;
|
|
4011
4049
|
}
|
|
@@ -4086,9 +4124,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4086
4124
|
this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
|
|
4087
4125
|
}
|
|
4088
4126
|
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4089
|
-
var
|
|
4090
|
-
var
|
|
4091
|
-
this.scheduleAdStopCountdown(
|
|
4127
|
+
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
4128
|
+
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
4129
|
+
this.scheduleAdStopCountdown(remainingMs1);
|
|
4092
4130
|
}
|
|
4093
4131
|
if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
|
|
4094
4132
|
var bids = this.pendingNextAdBids;
|