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
|
@@ -993,6 +993,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
993
993
|
var destroyed = false;
|
|
994
994
|
var tornDown = false;
|
|
995
995
|
var trackingFired = createEmptyTrackingState();
|
|
996
|
+
var adStallTimerId;
|
|
996
997
|
var currentAdEventHandlers;
|
|
997
998
|
var preloadSlots = /* @__PURE__ */ new Map();
|
|
998
999
|
function emit(event, payload) {
|
|
@@ -1108,7 +1109,14 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1108
1109
|
video.volume = 1;
|
|
1109
1110
|
return video;
|
|
1110
1111
|
}
|
|
1112
|
+
function clearAdStallTimer() {
|
|
1113
|
+
if (adStallTimerId != null) {
|
|
1114
|
+
clearTimeout(adStallTimerId);
|
|
1115
|
+
adStallTimerId = void 0;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1111
1118
|
function removeAdEventListeners() {
|
|
1119
|
+
clearAdStallTimer();
|
|
1112
1120
|
if (!currentAdEventHandlers || !adVideoElement) return;
|
|
1113
1121
|
var el = adVideoElement;
|
|
1114
1122
|
el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
|
|
@@ -1118,6 +1126,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1118
1126
|
el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
|
|
1119
1127
|
el.removeEventListener("pause", currentAdEventHandlers.pause);
|
|
1120
1128
|
el.removeEventListener("play", currentAdEventHandlers.play);
|
|
1129
|
+
el.removeEventListener("waiting", currentAdEventHandlers.waiting);
|
|
1121
1130
|
currentAdEventHandlers = void 0;
|
|
1122
1131
|
}
|
|
1123
1132
|
function setupAdEventListeners() {
|
|
@@ -1142,6 +1151,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1142
1151
|
}
|
|
1143
1152
|
},
|
|
1144
1153
|
playing: function playing() {
|
|
1154
|
+
clearAdStallTimer();
|
|
1145
1155
|
var ad = currentAd;
|
|
1146
1156
|
if (!ad || trackingFired.start) return;
|
|
1147
1157
|
trackingFired.start = true;
|
|
@@ -1178,6 +1188,16 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1178
1188
|
if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
|
|
1179
1189
|
fireTrackingPixels2(currentAd.trackingUrls.resume);
|
|
1180
1190
|
}
|
|
1191
|
+
},
|
|
1192
|
+
waiting: function waiting() {
|
|
1193
|
+
clearAdStallTimer();
|
|
1194
|
+
adStallTimerId = setTimeout(function() {
|
|
1195
|
+
adStallTimerId = void 0;
|
|
1196
|
+
if (adPlaying) {
|
|
1197
|
+
if (debug) console.warn("".concat(LOG, " Ad video stalled for too long, treating as error"));
|
|
1198
|
+
handleAdError();
|
|
1199
|
+
}
|
|
1200
|
+
}, 8e3);
|
|
1181
1201
|
}
|
|
1182
1202
|
};
|
|
1183
1203
|
adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
|
|
@@ -1187,6 +1207,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1187
1207
|
adVideoElement.addEventListener("volumechange", handlers.volumechange);
|
|
1188
1208
|
adVideoElement.addEventListener("pause", handlers.pause);
|
|
1189
1209
|
adVideoElement.addEventListener("play", handlers.play);
|
|
1210
|
+
adVideoElement.addEventListener("waiting", handlers.waiting);
|
|
1190
1211
|
currentAdEventHandlers = handlers;
|
|
1191
1212
|
}
|
|
1192
1213
|
function setAdPlayingFlag(isPlaying) {
|
|
@@ -1198,6 +1219,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1198
1219
|
}
|
|
1199
1220
|
function handleAdComplete() {
|
|
1200
1221
|
if (tornDown) return;
|
|
1222
|
+
clearAdStallTimer();
|
|
1201
1223
|
if (debug) console.log("".concat(LOG, " Handling ad completion"));
|
|
1202
1224
|
adPlaying = false;
|
|
1203
1225
|
setAdPlayingFlag(false);
|
|
@@ -1211,6 +1233,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1211
1233
|
function handleAdError() {
|
|
1212
1234
|
if (tornDown) return;
|
|
1213
1235
|
if (!adPlaying) return;
|
|
1236
|
+
clearAdStallTimer();
|
|
1214
1237
|
if (debug) console.log("".concat(LOG, " Handling ad error"));
|
|
1215
1238
|
adPlaying = false;
|
|
1216
1239
|
setAdPlayingFlag(false);
|
|
@@ -1261,6 +1284,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1261
1284
|
adHls.loadSource(mediaFile.url);
|
|
1262
1285
|
adHls.attachMedia(adVideoElement);
|
|
1263
1286
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
1287
|
+
if (!adPlaying) return;
|
|
1264
1288
|
adVideoElement.play().catch(function(error) {
|
|
1265
1289
|
console.error("".concat(LOG, " Error starting HLS ad playback:"), error);
|
|
1266
1290
|
handleAdError();
|
|
@@ -1894,6 +1918,7 @@ function createVastAdLayer(contentVideo, options) {
|
|
|
1894
1918
|
return 1;
|
|
1895
1919
|
},
|
|
1896
1920
|
showPlaceholder: function showPlaceholder() {
|
|
1921
|
+
if (singleElementMode) return;
|
|
1897
1922
|
contentVideo.style.opacity = "0";
|
|
1898
1923
|
contentVideo.style.visibility = "hidden";
|
|
1899
1924
|
if (!adContainerEl) {
|
|
@@ -3590,7 +3615,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3590
3615
|
}
|
|
3591
3616
|
_this.adLayer.cancelPreload(token);
|
|
3592
3617
|
} else {
|
|
3593
|
-
_this.
|
|
3618
|
+
if (!_this.config.singlePipelineMode) {
|
|
3619
|
+
_this.showPlaceholderLayer();
|
|
3620
|
+
}
|
|
3594
3621
|
_this.adLayer.showPlaceholder();
|
|
3595
3622
|
_this.isInAdTransition = true;
|
|
3596
3623
|
setTimeout(function() {
|
|
@@ -3614,7 +3641,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3614
3641
|
console.log("[StormcloudVideoPlayer] content_resume: skip pending bids, only", remainingNow1, "ms left");
|
|
3615
3642
|
}
|
|
3616
3643
|
} else {
|
|
3617
|
-
_this.
|
|
3644
|
+
if (!_this.config.singlePipelineMode) {
|
|
3645
|
+
_this.showPlaceholderLayer();
|
|
3646
|
+
}
|
|
3618
3647
|
_this.adLayer.showPlaceholder();
|
|
3619
3648
|
_this.isInAdTransition = true;
|
|
3620
3649
|
setTimeout(function() {
|
|
@@ -4982,7 +5011,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4982
5011
|
if (!this.config.disableFiller) this.showAds = true;
|
|
4983
5012
|
if (adBreakDurationMs != null) {
|
|
4984
5013
|
this.startFillerBreakTimer(adBreakDurationMs);
|
|
4985
|
-
} else if (!this.config.disableFiller) {
|
|
5014
|
+
} else if (!this.config.disableFiller && this.preloadedTokens.length === 0) {
|
|
4986
5015
|
this.showPlaceholderLayer();
|
|
4987
5016
|
}
|
|
4988
5017
|
if (!this.config.disableFiller) this.adLayer.showPlaceholder();
|