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
|
@@ -994,6 +994,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
994
994
|
var tornDown = false;
|
|
995
995
|
var trackingFired = createEmptyTrackingState();
|
|
996
996
|
var adStallTimerId;
|
|
997
|
+
var savedContentVideoStyles;
|
|
997
998
|
var currentAdEventHandlers;
|
|
998
999
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
999
1000
|
function emit(event, payload) {
|
|
@@ -1067,6 +1068,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1067
1068
|
} else if (debug) {
|
|
1068
1069
|
console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
|
|
1069
1070
|
}
|
|
1071
|
+
} else {
|
|
1072
|
+
var mp4Only1 = candidates.filter(function(f) {
|
|
1073
|
+
return !isHlsMediaFile(f);
|
|
1074
|
+
});
|
|
1075
|
+
if (mp4Only1.length > 0) {
|
|
1076
|
+
candidates = mp4Only1;
|
|
1077
|
+
if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
|
|
1078
|
+
}
|
|
1070
1079
|
}
|
|
1071
1080
|
var firstFile = candidates[0];
|
|
1072
1081
|
if (candidates.length === 1) return firstFile;
|
|
@@ -1102,7 +1111,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1102
1111
|
video.style.top = "0";
|
|
1103
1112
|
video.style.width = "100%";
|
|
1104
1113
|
video.style.height = "100%";
|
|
1105
|
-
video.style.objectFit = "
|
|
1114
|
+
video.style.objectFit = "cover";
|
|
1106
1115
|
video.style.backgroundColor = "#000";
|
|
1107
1116
|
video.playsInline = true;
|
|
1108
1117
|
video.muted = false;
|
|
@@ -1217,12 +1226,31 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1217
1226
|
delete contentVideo.dataset.stormcloudAdPlaying;
|
|
1218
1227
|
}
|
|
1219
1228
|
}
|
|
1229
|
+
function applyContentVideoAdCoverStyles() {
|
|
1230
|
+
if (!singleElementMode) return;
|
|
1231
|
+
savedContentVideoStyles = {
|
|
1232
|
+
objectFit: contentVideo.style.objectFit,
|
|
1233
|
+
width: contentVideo.style.width,
|
|
1234
|
+
height: contentVideo.style.height
|
|
1235
|
+
};
|
|
1236
|
+
contentVideo.style.objectFit = "cover";
|
|
1237
|
+
contentVideo.style.width = "100%";
|
|
1238
|
+
contentVideo.style.height = "100%";
|
|
1239
|
+
}
|
|
1240
|
+
function restoreContentVideoStyles() {
|
|
1241
|
+
if (!singleElementMode || !savedContentVideoStyles) return;
|
|
1242
|
+
contentVideo.style.objectFit = savedContentVideoStyles.objectFit;
|
|
1243
|
+
contentVideo.style.width = savedContentVideoStyles.width;
|
|
1244
|
+
contentVideo.style.height = savedContentVideoStyles.height;
|
|
1245
|
+
savedContentVideoStyles = void 0;
|
|
1246
|
+
}
|
|
1220
1247
|
function handleAdComplete() {
|
|
1221
1248
|
if (tornDown) return;
|
|
1222
1249
|
clearAdStallTimer();
|
|
1223
1250
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1224
1251
|
adPlaying = false;
|
|
1225
1252
|
setAdPlayingFlag(false);
|
|
1253
|
+
restoreContentVideoStyles();
|
|
1226
1254
|
if (adContainerEl) {
|
|
1227
1255
|
adContainerEl.style.display = "none";
|
|
1228
1256
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1237,6 +1265,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1237
1265
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1238
1266
|
adPlaying = false;
|
|
1239
1267
|
setAdPlayingFlag(false);
|
|
1268
|
+
restoreContentVideoStyles();
|
|
1240
1269
|
if (adContainerEl) {
|
|
1241
1270
|
adContainerEl.style.display = "none";
|
|
1242
1271
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1407,6 +1436,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1407
1436
|
];
|
|
1408
1437
|
contentVideo.style.visibility = "visible";
|
|
1409
1438
|
contentVideo.style.opacity = "1";
|
|
1439
|
+
applyContentVideoAdCoverStyles();
|
|
1410
1440
|
emit("content_pause");
|
|
1411
1441
|
setupAdEventListeners();
|
|
1412
1442
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1645,6 +1675,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1645
1675
|
];
|
|
1646
1676
|
contentVideo.style.visibility = "visible";
|
|
1647
1677
|
contentVideo.style.opacity = "1";
|
|
1678
|
+
applyContentVideoAdCoverStyles();
|
|
1648
1679
|
emit("content_pause");
|
|
1649
1680
|
setupAdEventListeners();
|
|
1650
1681
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1795,6 +1826,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1795
1826
|
if (debug) console.log("".concat(LOG, " Stopping ad"));
|
|
1796
1827
|
adPlaying = false;
|
|
1797
1828
|
setAdPlayingFlag(false);
|
|
1829
|
+
restoreContentVideoStyles();
|
|
1798
1830
|
contentVideo.muted = originalMutedState;
|
|
1799
1831
|
contentVideo.volume = originalMutedState ? 0 : originalVolume;
|
|
1800
1832
|
contentVideo.style.visibility = "visible";
|
|
@@ -1833,6 +1865,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1833
1865
|
destroyed = true;
|
|
1834
1866
|
adPlaying = false;
|
|
1835
1867
|
setAdPlayingFlag(false);
|
|
1868
|
+
restoreContentVideoStyles();
|
|
1836
1869
|
contentVideo.muted = originalMutedState;
|
|
1837
1870
|
contentVideo.volume = originalVolume;
|
|
1838
1871
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -4002,12 +4035,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4002
4035
|
}
|
|
4003
4036
|
}
|
|
4004
4037
|
if (this.inAdBreak) {
|
|
4005
|
-
if (
|
|
4006
|
-
|
|
4007
|
-
if (this.
|
|
4008
|
-
|
|
4038
|
+
if (marker.durationSeconds != null) {
|
|
4039
|
+
var newDurationMs = marker.durationSeconds * 1e3;
|
|
4040
|
+
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
4041
|
+
this.expectedAdBreakDurationMs = newDurationMs;
|
|
4042
|
+
var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
|
|
4043
|
+
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
4044
|
+
this.scheduleAdStopCountdown(remainingMs);
|
|
4045
|
+
if (this.config.debugAdTiming) {
|
|
4046
|
+
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
|
|
4047
|
+
}
|
|
4009
4048
|
}
|
|
4010
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4011
4049
|
}
|
|
4012
4050
|
return;
|
|
4013
4051
|
}
|
|
@@ -4088,9 +4126,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4088
4126
|
this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
|
|
4089
4127
|
}
|
|
4090
4128
|
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4091
|
-
var
|
|
4092
|
-
var
|
|
4093
|
-
this.scheduleAdStopCountdown(
|
|
4129
|
+
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
4130
|
+
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
4131
|
+
this.scheduleAdStopCountdown(remainingMs1);
|
|
4094
4132
|
}
|
|
4095
4133
|
if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
|
|
4096
4134
|
var bids = this.pendingNextAdBids;
|