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.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +570 -119
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +64 -1
- package/lib/index.d.ts +64 -1
- package/lib/index.js +536 -101
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +66 -1
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +4 -0
- package/lib/players/HlsPlayer.cjs +66 -1
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +66 -1
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/vastAdLayer.cjs +26 -1
- package/lib/sdk/vastAdLayer.cjs.map +1 -1
- package/lib/ui/OverlayRenderer.cjs +392 -0
- package/lib/ui/OverlayRenderer.cjs.map +1 -0
- package/lib/ui/OverlayRenderer.d.cts +15 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +530 -95
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/utils/overlays.cjs +286 -0
- package/lib/utils/overlays.cjs.map +1 -0
- package/lib/utils/overlays.d.cts +59 -0
- 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) {
|
|
@@ -1058,7 +1059,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1058
1059
|
video.style.top = "0";
|
|
1059
1060
|
video.style.width = "100%";
|
|
1060
1061
|
video.style.height = "100%";
|
|
1061
|
-
video.style.objectFit = "
|
|
1062
|
+
video.style.objectFit = "cover";
|
|
1062
1063
|
video.style.backgroundColor = "#000";
|
|
1063
1064
|
video.playsInline = true;
|
|
1064
1065
|
video.muted = false;
|
|
@@ -1173,12 +1174,31 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1173
1174
|
delete contentVideo.dataset.stormcloudAdPlaying;
|
|
1174
1175
|
}
|
|
1175
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
|
+
}
|
|
1176
1195
|
function handleAdComplete() {
|
|
1177
1196
|
if (tornDown) return;
|
|
1178
1197
|
clearAdStallTimer();
|
|
1179
1198
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1180
1199
|
adPlaying = false;
|
|
1181
1200
|
setAdPlayingFlag(false);
|
|
1201
|
+
restoreContentVideoStyles();
|
|
1182
1202
|
if (adContainerEl) {
|
|
1183
1203
|
adContainerEl.style.display = "none";
|
|
1184
1204
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1193,6 +1213,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1193
1213
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1194
1214
|
adPlaying = false;
|
|
1195
1215
|
setAdPlayingFlag(false);
|
|
1216
|
+
restoreContentVideoStyles();
|
|
1196
1217
|
if (adContainerEl) {
|
|
1197
1218
|
adContainerEl.style.display = "none";
|
|
1198
1219
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -1363,6 +1384,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1363
1384
|
];
|
|
1364
1385
|
contentVideo.style.visibility = "visible";
|
|
1365
1386
|
contentVideo.style.opacity = "1";
|
|
1387
|
+
applyContentVideoAdCoverStyles();
|
|
1366
1388
|
emit("content_pause");
|
|
1367
1389
|
setupAdEventListeners();
|
|
1368
1390
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1601,6 +1623,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1601
1623
|
];
|
|
1602
1624
|
contentVideo.style.visibility = "visible";
|
|
1603
1625
|
contentVideo.style.opacity = "1";
|
|
1626
|
+
applyContentVideoAdCoverStyles();
|
|
1604
1627
|
emit("content_pause");
|
|
1605
1628
|
setupAdEventListeners();
|
|
1606
1629
|
adVolume2 = originalMutedState ? 1 : originalVolume;
|
|
@@ -1751,6 +1774,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1751
1774
|
if (debug) console.log("".concat(LOG, " Stopping ad"));
|
|
1752
1775
|
adPlaying = false;
|
|
1753
1776
|
setAdPlayingFlag(false);
|
|
1777
|
+
restoreContentVideoStyles();
|
|
1754
1778
|
contentVideo.muted = originalMutedState;
|
|
1755
1779
|
contentVideo.volume = originalMutedState ? 0 : originalVolume;
|
|
1756
1780
|
contentVideo.style.visibility = "visible";
|
|
@@ -1789,6 +1813,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1789
1813
|
destroyed = true;
|
|
1790
1814
|
adPlaying = false;
|
|
1791
1815
|
setAdPlayingFlag(false);
|
|
1816
|
+
restoreContentVideoStyles();
|
|
1792
1817
|
contentVideo.muted = originalMutedState;
|
|
1793
1818
|
contentVideo.volume = originalVolume;
|
|
1794
1819
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -5957,6 +5982,46 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5957
5982
|
return this.isLiveStream;
|
|
5958
5983
|
}
|
|
5959
5984
|
},
|
|
5985
|
+
{
|
|
5986
|
+
key: "getMinHlsResolution",
|
|
5987
|
+
value: function getMinHlsResolution() {
|
|
5988
|
+
var _this_hls;
|
|
5989
|
+
var levels = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.levels;
|
|
5990
|
+
if (!levels || levels.length === 0) return null;
|
|
5991
|
+
var min = null;
|
|
5992
|
+
var minPixels = Infinity;
|
|
5993
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5994
|
+
try {
|
|
5995
|
+
for(var _iterator = levels[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5996
|
+
var level = _step.value;
|
|
5997
|
+
if (level.width && level.height) {
|
|
5998
|
+
var pixels = level.width * level.height;
|
|
5999
|
+
if (pixels < minPixels) {
|
|
6000
|
+
minPixels = pixels;
|
|
6001
|
+
min = {
|
|
6002
|
+
width: level.width,
|
|
6003
|
+
height: level.height
|
|
6004
|
+
};
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
}
|
|
6008
|
+
} catch (err) {
|
|
6009
|
+
_didIteratorError = true;
|
|
6010
|
+
_iteratorError = err;
|
|
6011
|
+
} finally{
|
|
6012
|
+
try {
|
|
6013
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6014
|
+
_iterator.return();
|
|
6015
|
+
}
|
|
6016
|
+
} finally{
|
|
6017
|
+
if (_didIteratorError) {
|
|
6018
|
+
throw _iteratorError;
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6021
|
+
}
|
|
6022
|
+
return min;
|
|
6023
|
+
}
|
|
6024
|
+
},
|
|
5960
6025
|
{
|
|
5961
6026
|
key: "videoElement",
|
|
5962
6027
|
get: function get() {
|