stormcloud-video-player 0.2.19 → 0.2.20
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 +2 -2
- package/lib/index.cjs +97 -37
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +97 -37
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +97 -37
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +97 -37
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +97 -37
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +30 -16
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/ima.cjs +32 -18
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +97 -37
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -525,28 +525,42 @@ function createImaController(video, options) {
|
|
|
525
525
|
adsManager.addEventListener(
|
|
526
526
|
AdEvent.CONTENT_RESUME_REQUESTED,
|
|
527
527
|
() => {
|
|
528
|
-
var _a;
|
|
529
528
|
console.log("[IMA] Content resume requested");
|
|
530
529
|
adPlaying = false;
|
|
531
|
-
video.muted = originalMutedState;
|
|
532
530
|
setAdPlayingFlag(false);
|
|
533
|
-
if (adContainerEl) {
|
|
534
|
-
adContainerEl.style.pointerEvents = "none";
|
|
535
|
-
adContainerEl.style.display = "none";
|
|
536
|
-
console.log(
|
|
537
|
-
"[IMA] Ad container hidden - pointer events disabled"
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
541
|
-
(_a = video.play()) == null ? void 0 : _a.catch(() => {
|
|
542
|
-
});
|
|
543
|
-
console.log("[IMA] Video resumed (VOD mode)");
|
|
544
|
-
} else {
|
|
545
|
-
console.log(
|
|
546
|
-
"[IMA] Video unmuted (Live mode - was never paused)"
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
531
|
emit("content_resume");
|
|
532
|
+
setTimeout(() => {
|
|
533
|
+
var _a;
|
|
534
|
+
const stillInAdPod = video.dataset.stormcloudAdPlaying === "true";
|
|
535
|
+
if (stillInAdPod) {
|
|
536
|
+
console.log(
|
|
537
|
+
"[IMA] Next ad started - keeping content muted/paused and ad container visible"
|
|
538
|
+
);
|
|
539
|
+
if (adContainerEl) {
|
|
540
|
+
adContainerEl.style.display = "flex";
|
|
541
|
+
adContainerEl.style.pointerEvents = "auto";
|
|
542
|
+
}
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
console.log("[IMA] No next ad - resuming content");
|
|
546
|
+
video.muted = originalMutedState;
|
|
547
|
+
if (adContainerEl) {
|
|
548
|
+
adContainerEl.style.pointerEvents = "none";
|
|
549
|
+
adContainerEl.style.display = "none";
|
|
550
|
+
console.log(
|
|
551
|
+
"[IMA] Ad container hidden - pointer events disabled"
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
555
|
+
(_a = video.play()) == null ? void 0 : _a.catch(() => {
|
|
556
|
+
});
|
|
557
|
+
console.log("[IMA] Video resumed (VOD mode)");
|
|
558
|
+
} else {
|
|
559
|
+
console.log(
|
|
560
|
+
"[IMA] Video unmuted (Live mode - was never paused)"
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
}, 100);
|
|
550
564
|
}
|
|
551
565
|
);
|
|
552
566
|
adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, () => {
|
|
@@ -1121,24 +1135,38 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1121
1135
|
console.log("[HlsAdPlayer] Handling ad completion");
|
|
1122
1136
|
adPlaying = false;
|
|
1123
1137
|
setAdPlayingFlag(false);
|
|
1124
|
-
const previousMutedState = contentVideo.muted;
|
|
1125
|
-
contentVideo.muted = originalMutedState;
|
|
1126
|
-
console.log(
|
|
1127
|
-
`[HlsAdPlayer] Restored mute state: ${previousMutedState} -> ${originalMutedState}`
|
|
1128
|
-
);
|
|
1129
|
-
if (adContainerEl) {
|
|
1130
|
-
adContainerEl.style.display = "none";
|
|
1131
|
-
adContainerEl.style.pointerEvents = "none";
|
|
1132
|
-
}
|
|
1133
|
-
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
1134
|
-
contentVideo.play().catch(() => {
|
|
1135
|
-
});
|
|
1136
|
-
console.log("[HlsAdPlayer] Content resumed (VOD mode)");
|
|
1137
|
-
} else {
|
|
1138
|
-
console.log("[HlsAdPlayer] Content unmuted (Live mode)");
|
|
1139
|
-
}
|
|
1140
1138
|
emit("content_resume");
|
|
1141
1139
|
emit("all_ads_completed");
|
|
1140
|
+
setTimeout(() => {
|
|
1141
|
+
const stillInAdPod = contentVideo.dataset.stormcloudAdPlaying === "true";
|
|
1142
|
+
if (stillInAdPod) {
|
|
1143
|
+
console.log(
|
|
1144
|
+
"[HlsAdPlayer] Next ad started - keeping content muted/paused and ad container visible"
|
|
1145
|
+
);
|
|
1146
|
+
if (adContainerEl) {
|
|
1147
|
+
adContainerEl.style.display = "flex";
|
|
1148
|
+
adContainerEl.style.pointerEvents = "auto";
|
|
1149
|
+
}
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
console.log("[HlsAdPlayer] No next ad - resuming content");
|
|
1153
|
+
const previousMutedState = contentVideo.muted;
|
|
1154
|
+
contentVideo.muted = originalMutedState;
|
|
1155
|
+
console.log(
|
|
1156
|
+
`[HlsAdPlayer] Restored mute state: ${previousMutedState} -> ${originalMutedState}`
|
|
1157
|
+
);
|
|
1158
|
+
if (adContainerEl) {
|
|
1159
|
+
adContainerEl.style.display = "none";
|
|
1160
|
+
adContainerEl.style.pointerEvents = "none";
|
|
1161
|
+
}
|
|
1162
|
+
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
1163
|
+
contentVideo.play().catch(() => {
|
|
1164
|
+
});
|
|
1165
|
+
console.log("[HlsAdPlayer] Content resumed (VOD mode)");
|
|
1166
|
+
} else {
|
|
1167
|
+
console.log("[HlsAdPlayer] Content unmuted (Live mode)");
|
|
1168
|
+
}
|
|
1169
|
+
}, 100);
|
|
1142
1170
|
}
|
|
1143
1171
|
function handleAdError() {
|
|
1144
1172
|
console.log("[HlsAdPlayer] Handling ad error");
|
|
@@ -1876,6 +1904,7 @@ var StormcloudVideoPlayer = class {
|
|
|
1876
1904
|
this.bufferedSegmentsCount = 0;
|
|
1877
1905
|
this.shouldAutoplayAfterBuffering = false;
|
|
1878
1906
|
this.hasInitialBufferCompleted = false;
|
|
1907
|
+
this.isTransitioningBetweenAds = false;
|
|
1879
1908
|
initializePolyfills();
|
|
1880
1909
|
const browserOverrides = getBrowserConfigOverrides();
|
|
1881
1910
|
this.config = { ...config, ...browserOverrides };
|
|
@@ -2177,29 +2206,60 @@ var StormcloudVideoPlayer = class {
|
|
|
2177
2206
|
this.ima.on("content_resume", () => {
|
|
2178
2207
|
if (this.config.debugAdTiming) {
|
|
2179
2208
|
console.log(
|
|
2180
|
-
"[StormcloudVideoPlayer] IMA content_resume event received"
|
|
2209
|
+
"[StormcloudVideoPlayer] IMA content_resume event received",
|
|
2210
|
+
{
|
|
2211
|
+
inAdBreak: this.inAdBreak,
|
|
2212
|
+
isTransitioningBetweenAds: this.isTransitioningBetweenAds,
|
|
2213
|
+
pendingAds: this.adPodQueue.length
|
|
2214
|
+
}
|
|
2181
2215
|
);
|
|
2182
2216
|
}
|
|
2183
2217
|
this.clearAdFailsafeTimer();
|
|
2184
|
-
if (
|
|
2218
|
+
if (this.isTransitioningBetweenAds) {
|
|
2219
|
+
if (this.config.debugAdTiming) {
|
|
2220
|
+
console.log(
|
|
2221
|
+
"[StormcloudVideoPlayer] Transitioning between ads - keeping content muted/paused"
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
return;
|
|
2225
|
+
}
|
|
2226
|
+
if (!this.inAdBreak) {
|
|
2227
|
+
if (this.config.debugAdTiming) {
|
|
2228
|
+
console.log(
|
|
2229
|
+
"[StormcloudVideoPlayer] Not in ad break, allowing normal content resume"
|
|
2230
|
+
);
|
|
2231
|
+
}
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2185
2234
|
const remaining = this.getRemainingAdMs();
|
|
2186
2235
|
if (remaining > 500 && this.adPodQueue.length > 0) {
|
|
2236
|
+
this.isTransitioningBetweenAds = true;
|
|
2237
|
+
this.video.muted = true;
|
|
2238
|
+
if (!this.shouldContinueLiveStreamDuringAds()) {
|
|
2239
|
+
this.video.pause();
|
|
2240
|
+
}
|
|
2187
2241
|
const next = this.adPodQueue.shift();
|
|
2188
2242
|
this.currentAdIndex++;
|
|
2189
2243
|
if (this.config.debugAdTiming) {
|
|
2190
2244
|
console.log(
|
|
2191
|
-
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak})`
|
|
2245
|
+
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - keeping content muted/paused`
|
|
2192
2246
|
);
|
|
2193
2247
|
}
|
|
2194
2248
|
this.playSingleAd(next).catch(() => {
|
|
2249
|
+
}).finally(() => {
|
|
2250
|
+
this.isTransitioningBetweenAds = false;
|
|
2195
2251
|
});
|
|
2196
2252
|
} else {
|
|
2197
2253
|
if (this.config.debugAdTiming) {
|
|
2198
2254
|
console.log("[StormcloudVideoPlayer] Ad pod completed");
|
|
2199
2255
|
}
|
|
2256
|
+
this.inAdBreak = false;
|
|
2257
|
+
this.expectedAdBreakDurationMs = void 0;
|
|
2258
|
+
this.currentAdBreakStartWallClockMs = void 0;
|
|
2200
2259
|
this.currentAdIndex = 0;
|
|
2201
2260
|
this.totalAdsInBreak = 0;
|
|
2202
2261
|
this.showAds = false;
|
|
2262
|
+
this.clearAdStopTimer();
|
|
2203
2263
|
}
|
|
2204
2264
|
});
|
|
2205
2265
|
this.video.addEventListener("timeupdate", () => {
|