stormcloud-video-player 0.2.18 → 0.2.19
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 +54 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +54 -2
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +54 -2
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +54 -2
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +54 -2
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/sdk/ima.d.cts +1 -1
- package/lib/{types-J6-Dpcvw.d.cts → types-D1xfSdLP.d.cts} +2 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +54 -2
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +1 -1
|
@@ -2876,14 +2876,66 @@ var StormcloudVideoPlayer = class {
|
|
|
2876
2876
|
}
|
|
2877
2877
|
}
|
|
2878
2878
|
ensureAdStoppedByTimer() {
|
|
2879
|
+
var _a, _b;
|
|
2879
2880
|
if (!this.inAdBreak) return;
|
|
2881
|
+
this.adStopTimerId = void 0;
|
|
2882
|
+
const adPlaying = this.ima.isAdPlaying();
|
|
2883
|
+
const pendingAds = this.adPodQueue.length > 0;
|
|
2884
|
+
const checkIntervalMs = Math.max(
|
|
2885
|
+
250,
|
|
2886
|
+
Math.floor((_a = this.config.adBreakCheckIntervalMs) != null ? _a : 1e3)
|
|
2887
|
+
);
|
|
2888
|
+
const maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
2889
|
+
const maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
|
|
2890
|
+
let elapsedSinceStartMs = 0;
|
|
2891
|
+
if (this.currentAdBreakStartWallClockMs != null) {
|
|
2892
|
+
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
2893
|
+
}
|
|
2894
|
+
const expectedDurationMs = (_b = this.expectedAdBreakDurationMs) != null ? _b : 0;
|
|
2895
|
+
const overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
2896
|
+
const shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
2897
|
+
if (shouldExtendAdBreak) {
|
|
2898
|
+
if (this.config.debugAdTiming) {
|
|
2899
|
+
console.log(
|
|
2900
|
+
"[StormcloudVideoPlayer] Extending ad break beyond scheduled duration",
|
|
2901
|
+
{
|
|
2902
|
+
adPlaying,
|
|
2903
|
+
pendingAds,
|
|
2904
|
+
showAds: this.showAds,
|
|
2905
|
+
overrunMs,
|
|
2906
|
+
checkIntervalMs,
|
|
2907
|
+
maxExtensionMs
|
|
2908
|
+
}
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2911
|
+
this.scheduleAdStopCountdown(checkIntervalMs);
|
|
2912
|
+
return;
|
|
2913
|
+
}
|
|
2914
|
+
if (this.config.debugAdTiming) {
|
|
2915
|
+
console.log("[StormcloudVideoPlayer] Ending ad break via timer", {
|
|
2916
|
+
adPlaying,
|
|
2917
|
+
pendingAds,
|
|
2918
|
+
showAds: this.showAds,
|
|
2919
|
+
overrunMs,
|
|
2920
|
+
maxExtensionMs
|
|
2921
|
+
});
|
|
2922
|
+
}
|
|
2880
2923
|
this.inAdBreak = false;
|
|
2881
2924
|
this.expectedAdBreakDurationMs = void 0;
|
|
2882
2925
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
2883
|
-
this.
|
|
2884
|
-
|
|
2926
|
+
this.showAds = false;
|
|
2927
|
+
this.adPodQueue = [];
|
|
2928
|
+
this.currentAdIndex = 0;
|
|
2929
|
+
this.totalAdsInBreak = 0;
|
|
2930
|
+
this.clearAdFailsafeTimer();
|
|
2931
|
+
if (adPlaying) {
|
|
2885
2932
|
this.ima.stop().catch(() => {
|
|
2886
2933
|
});
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
const originalMutedState = this.ima.getOriginalMutedState();
|
|
2937
|
+
if (this.video.muted !== originalMutedState) {
|
|
2938
|
+
this.video.muted = originalMutedState;
|
|
2887
2939
|
}
|
|
2888
2940
|
}
|
|
2889
2941
|
scheduleAdStartIn(delayMs) {
|