stormcloud-video-player 0.6.3 → 0.6.4
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 +32 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +32 -3
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +32 -3
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +32 -3
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +32 -3
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/vastAdLayer.cjs +25 -0
- package/lib/sdk/vastAdLayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +32 -3
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1123,6 +1123,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1123
1123
|
var destroyed = false;
|
|
1124
1124
|
var tornDown = false;
|
|
1125
1125
|
var trackingFired = createEmptyTrackingState();
|
|
1126
|
+
var adStallTimerId;
|
|
1126
1127
|
var currentAdEventHandlers;
|
|
1127
1128
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
1128
1129
|
function emit(event, payload) {
|
|
@@ -1238,7 +1239,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1238
1239
|
video.volume = 1;
|
|
1239
1240
|
return video;
|
|
1240
1241
|
}
|
|
1242
|
+
function clearAdStallTimer() {
|
|
1243
|
+
if (adStallTimerId != null) {
|
|
1244
|
+
clearTimeout(adStallTimerId);
|
|
1245
|
+
adStallTimerId = void 0;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1241
1248
|
function removeAdEventListeners() {
|
|
1249
|
+
clearAdStallTimer();
|
|
1242
1250
|
if (!currentAdEventHandlers || !adVideoElement) return;
|
|
1243
1251
|
var el = adVideoElement;
|
|
1244
1252
|
el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
|
|
@@ -1248,6 +1256,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1248
1256
|
el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
|
|
1249
1257
|
el.removeEventListener("pause", currentAdEventHandlers.pause);
|
|
1250
1258
|
el.removeEventListener("play", currentAdEventHandlers.play);
|
|
1259
|
+
el.removeEventListener("waiting", currentAdEventHandlers.waiting);
|
|
1251
1260
|
currentAdEventHandlers = void 0;
|
|
1252
1261
|
}
|
|
1253
1262
|
function setupAdEventListeners() {
|
|
@@ -1272,6 +1281,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1272
1281
|
}
|
|
1273
1282
|
},
|
|
1274
1283
|
playing: function playing() {
|
|
1284
|
+
clearAdStallTimer();
|
|
1275
1285
|
var ad = currentAd;
|
|
1276
1286
|
if (!ad || trackingFired.start) return;
|
|
1277
1287
|
trackingFired.start = true;
|
|
@@ -1308,6 +1318,16 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1308
1318
|
if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
|
|
1309
1319
|
fireTrackingPixels2(currentAd.trackingUrls.resume);
|
|
1310
1320
|
}
|
|
1321
|
+
},
|
|
1322
|
+
waiting: function waiting() {
|
|
1323
|
+
clearAdStallTimer();
|
|
1324
|
+
adStallTimerId = setTimeout(function() {
|
|
1325
|
+
adStallTimerId = void 0;
|
|
1326
|
+
if (adPlaying) {
|
|
1327
|
+
if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
|
|
1328
|
+
handleAdError();
|
|
1329
|
+
}
|
|
1330
|
+
}, 8e3);
|
|
1311
1331
|
}
|
|
1312
1332
|
};
|
|
1313
1333
|
adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
|
|
@@ -1317,6 +1337,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1317
1337
|
adVideoElement.addEventListener("volumechange", handlers.volumechange);
|
|
1318
1338
|
adVideoElement.addEventListener("pause", handlers.pause);
|
|
1319
1339
|
adVideoElement.addEventListener("play", handlers.play);
|
|
1340
|
+
adVideoElement.addEventListener("waiting", handlers.waiting);
|
|
1320
1341
|
currentAdEventHandlers = handlers;
|
|
1321
1342
|
}
|
|
1322
1343
|
function setAdPlayingFlag(isPlaying) {
|
|
@@ -1328,6 +1349,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1328
1349
|
}
|
|
1329
1350
|
function handleAdComplete() {
|
|
1330
1351
|
if (tornDown) return;
|
|
1352
|
+
clearAdStallTimer();
|
|
1331
1353
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1332
1354
|
adPlaying = false;
|
|
1333
1355
|
setAdPlayingFlag(false);
|
|
@@ -1341,6 +1363,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1341
1363
|
function handleAdError() {
|
|
1342
1364
|
if (tornDown) return;
|
|
1343
1365
|
if (!adPlaying) return;
|
|
1366
|
+
clearAdStallTimer();
|
|
1344
1367
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1345
1368
|
adPlaying = false;
|
|
1346
1369
|
setAdPlayingFlag(false);
|
|
@@ -1391,6 +1414,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1391
1414
|
adHls.loadSource(mediaFile.url);
|
|
1392
1415
|
adHls.attachMedia(adVideoElement);
|
|
1393
1416
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
1417
|
+
if (!adPlaying) return;
|
|
1394
1418
|
adVideoElement.play().catch(function(error) {
|
|
1395
1419
|
console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
|
|
1396
1420
|
handleAdError();
|
|
@@ -2024,6 +2048,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
2024
2048
|
return 1;
|
|
2025
2049
|
},
|
|
2026
2050
|
showPlaceholder: function showPlaceholder() {
|
|
2051
|
+
if (singleElementMode) return;
|
|
2027
2052
|
contentVideo.style.opacity = "0";
|
|
2028
2053
|
contentVideo.style.visibility = "hidden";
|
|
2029
2054
|
if (!adContainerEl) {
|
|
@@ -3745,7 +3770,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3745
3770
|
}
|
|
3746
3771
|
_this.adLayer.cancelPreload(token);
|
|
3747
3772
|
} else {
|
|
3748
|
-
_this.
|
|
3773
|
+
if (!_this.config.singlePipelineMode) {
|
|
3774
|
+
_this.showPlaceholderLayer();
|
|
3775
|
+
}
|
|
3749
3776
|
_this.adLayer.showPlaceholder();
|
|
3750
3777
|
_this.isInAdTransition = true;
|
|
3751
3778
|
setTimeout(function() {
|
|
@@ -3769,7 +3796,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3769
3796
|
console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
|
|
3770
3797
|
}
|
|
3771
3798
|
} else {
|
|
3772
|
-
_this.
|
|
3799
|
+
if (!_this.config.singlePipelineMode) {
|
|
3800
|
+
_this.showPlaceholderLayer();
|
|
3801
|
+
}
|
|
3773
3802
|
_this.adLayer.showPlaceholder();
|
|
3774
3803
|
_this.isInAdTransition = true;
|
|
3775
3804
|
setTimeout(function() {
|
|
@@ -5137,7 +5166,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5137
5166
|
if (!this.config.disableFiller) this.showAds = true;
|
|
5138
5167
|
if (adBreakDurationMs != null) {
|
|
5139
5168
|
this.startFillerBreakTimer(adBreakDurationMs);
|
|
5140
|
-
} else if (!this.config.disableFiller) {
|
|
5169
|
+
} else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
|
|
5141
5170
|
this.showPlaceholderLayer();
|
|
5142
5171
|
}
|
|
5143
5172
|
if (!this.config.disableFiller) this.adLayer.showPlaceholder();
|