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
|
@@ -941,6 +941,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
941
941
|
var destroyed = false;
|
|
942
942
|
var tornDown = false;
|
|
943
943
|
var trackingFired = createEmptyTrackingState();
|
|
944
|
+
var adStallTimerId;
|
|
944
945
|
var currentAdEventHandlers;
|
|
945
946
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
946
947
|
function emit(event, payload) {
|
|
@@ -1056,7 +1057,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1056
1057
|
video.volume = 1;
|
|
1057
1058
|
return video;
|
|
1058
1059
|
}
|
|
1060
|
+
function clearAdStallTimer() {
|
|
1061
|
+
if (adStallTimerId != null) {
|
|
1062
|
+
clearTimeout(adStallTimerId);
|
|
1063
|
+
adStallTimerId = void 0;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1059
1066
|
function removeAdEventListeners() {
|
|
1067
|
+
clearAdStallTimer();
|
|
1060
1068
|
if (!currentAdEventHandlers || !adVideoElement) return;
|
|
1061
1069
|
var el = adVideoElement;
|
|
1062
1070
|
el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
|
|
@@ -1066,6 +1074,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1066
1074
|
el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
|
|
1067
1075
|
el.removeEventListener("pause", currentAdEventHandlers.pause);
|
|
1068
1076
|
el.removeEventListener("play", currentAdEventHandlers.play);
|
|
1077
|
+
el.removeEventListener("waiting", currentAdEventHandlers.waiting);
|
|
1069
1078
|
currentAdEventHandlers = void 0;
|
|
1070
1079
|
}
|
|
1071
1080
|
function setupAdEventListeners() {
|
|
@@ -1090,6 +1099,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1090
1099
|
}
|
|
1091
1100
|
},
|
|
1092
1101
|
playing: function playing() {
|
|
1102
|
+
clearAdStallTimer();
|
|
1093
1103
|
var ad = currentAd;
|
|
1094
1104
|
if (!ad || trackingFired.start) return;
|
|
1095
1105
|
trackingFired.start = true;
|
|
@@ -1126,6 +1136,16 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1126
1136
|
if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
|
|
1127
1137
|
fireTrackingPixels2(currentAd.trackingUrls.resume);
|
|
1128
1138
|
}
|
|
1139
|
+
},
|
|
1140
|
+
waiting: function waiting() {
|
|
1141
|
+
clearAdStallTimer();
|
|
1142
|
+
adStallTimerId = setTimeout(function() {
|
|
1143
|
+
adStallTimerId = void 0;
|
|
1144
|
+
if (adPlaying) {
|
|
1145
|
+
if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
|
|
1146
|
+
handleAdError();
|
|
1147
|
+
}
|
|
1148
|
+
}, 8e3);
|
|
1129
1149
|
}
|
|
1130
1150
|
};
|
|
1131
1151
|
adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
|
|
@@ -1135,6 +1155,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1135
1155
|
adVideoElement.addEventListener("volumechange", handlers.volumechange);
|
|
1136
1156
|
adVideoElement.addEventListener("pause", handlers.pause);
|
|
1137
1157
|
adVideoElement.addEventListener("play", handlers.play);
|
|
1158
|
+
adVideoElement.addEventListener("waiting", handlers.waiting);
|
|
1138
1159
|
currentAdEventHandlers = handlers;
|
|
1139
1160
|
}
|
|
1140
1161
|
function setAdPlayingFlag(isPlaying) {
|
|
@@ -1146,6 +1167,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1146
1167
|
}
|
|
1147
1168
|
function handleAdComplete() {
|
|
1148
1169
|
if (tornDown) return;
|
|
1170
|
+
clearAdStallTimer();
|
|
1149
1171
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1150
1172
|
adPlaying = false;
|
|
1151
1173
|
setAdPlayingFlag(false);
|
|
@@ -1159,6 +1181,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1159
1181
|
function handleAdError() {
|
|
1160
1182
|
if (tornDown) return;
|
|
1161
1183
|
if (!adPlaying) return;
|
|
1184
|
+
clearAdStallTimer();
|
|
1162
1185
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1163
1186
|
adPlaying = false;
|
|
1164
1187
|
setAdPlayingFlag(false);
|
|
@@ -1209,6 +1232,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1209
1232
|
adHls.loadSource(mediaFile.url);
|
|
1210
1233
|
adHls.attachMedia(adVideoElement);
|
|
1211
1234
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
1235
|
+
if (!adPlaying) return;
|
|
1212
1236
|
adVideoElement.play().catch(function(error) {
|
|
1213
1237
|
console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
|
|
1214
1238
|
handleAdError();
|
|
@@ -1842,6 +1866,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1842
1866
|
return 1;
|
|
1843
1867
|
},
|
|
1844
1868
|
showPlaceholder: function showPlaceholder() {
|
|
1869
|
+
if (singleElementMode) return;
|
|
1845
1870
|
contentVideo.style.opacity = "0";
|
|
1846
1871
|
contentVideo.style.visibility = "hidden";
|
|
1847
1872
|
if (!adContainerEl) {
|
|
@@ -3538,7 +3563,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3538
3563
|
}
|
|
3539
3564
|
_this.adLayer.cancelPreload(token);
|
|
3540
3565
|
} else {
|
|
3541
|
-
_this.
|
|
3566
|
+
if (!_this.config.singlePipelineMode) {
|
|
3567
|
+
_this.showPlaceholderLayer();
|
|
3568
|
+
}
|
|
3542
3569
|
_this.adLayer.showPlaceholder();
|
|
3543
3570
|
_this.isInAdTransition = true;
|
|
3544
3571
|
setTimeout(function() {
|
|
@@ -3562,7 +3589,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3562
3589
|
console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
|
|
3563
3590
|
}
|
|
3564
3591
|
} else {
|
|
3565
|
-
_this.
|
|
3592
|
+
if (!_this.config.singlePipelineMode) {
|
|
3593
|
+
_this.showPlaceholderLayer();
|
|
3594
|
+
}
|
|
3566
3595
|
_this.adLayer.showPlaceholder();
|
|
3567
3596
|
_this.isInAdTransition = true;
|
|
3568
3597
|
setTimeout(function() {
|
|
@@ -4930,7 +4959,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4930
4959
|
if (!this.config.disableFiller) this.showAds = true;
|
|
4931
4960
|
if (adBreakDurationMs != null) {
|
|
4932
4961
|
this.startFillerBreakTimer(adBreakDurationMs);
|
|
4933
|
-
} else if (!this.config.disableFiller) {
|
|
4962
|
+
} else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
|
|
4934
4963
|
this.showPlaceholderLayer();
|
|
4935
4964
|
}
|
|
4936
4965
|
if (!this.config.disableFiller) this.adLayer.showPlaceholder();
|