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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import { S as StormcloudVideoPlayerConfig } from '../types-
|
|
2
|
+
import { S as StormcloudVideoPlayerConfig } from '../types-D1xfSdLP.cjs';
|
|
3
3
|
|
|
4
4
|
interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
|
|
5
5
|
onMount?: (player: any) => void;
|
package/lib/players/index.cjs
CHANGED
|
@@ -2915,14 +2915,66 @@ var StormcloudVideoPlayer = class {
|
|
|
2915
2915
|
}
|
|
2916
2916
|
}
|
|
2917
2917
|
ensureAdStoppedByTimer() {
|
|
2918
|
+
var _a, _b;
|
|
2918
2919
|
if (!this.inAdBreak) return;
|
|
2920
|
+
this.adStopTimerId = void 0;
|
|
2921
|
+
const adPlaying = this.ima.isAdPlaying();
|
|
2922
|
+
const pendingAds = this.adPodQueue.length > 0;
|
|
2923
|
+
const checkIntervalMs = Math.max(
|
|
2924
|
+
250,
|
|
2925
|
+
Math.floor((_a = this.config.adBreakCheckIntervalMs) != null ? _a : 1e3)
|
|
2926
|
+
);
|
|
2927
|
+
const maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
2928
|
+
const maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
|
|
2929
|
+
let elapsedSinceStartMs = 0;
|
|
2930
|
+
if (this.currentAdBreakStartWallClockMs != null) {
|
|
2931
|
+
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
2932
|
+
}
|
|
2933
|
+
const expectedDurationMs = (_b = this.expectedAdBreakDurationMs) != null ? _b : 0;
|
|
2934
|
+
const overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
2935
|
+
const shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
2936
|
+
if (shouldExtendAdBreak) {
|
|
2937
|
+
if (this.config.debugAdTiming) {
|
|
2938
|
+
console.log(
|
|
2939
|
+
"[StormcloudVideoPlayer] Extending ad break beyond scheduled duration",
|
|
2940
|
+
{
|
|
2941
|
+
adPlaying,
|
|
2942
|
+
pendingAds,
|
|
2943
|
+
showAds: this.showAds,
|
|
2944
|
+
overrunMs,
|
|
2945
|
+
checkIntervalMs,
|
|
2946
|
+
maxExtensionMs
|
|
2947
|
+
}
|
|
2948
|
+
);
|
|
2949
|
+
}
|
|
2950
|
+
this.scheduleAdStopCountdown(checkIntervalMs);
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
if (this.config.debugAdTiming) {
|
|
2954
|
+
console.log("[StormcloudVideoPlayer] Ending ad break via timer", {
|
|
2955
|
+
adPlaying,
|
|
2956
|
+
pendingAds,
|
|
2957
|
+
showAds: this.showAds,
|
|
2958
|
+
overrunMs,
|
|
2959
|
+
maxExtensionMs
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2919
2962
|
this.inAdBreak = false;
|
|
2920
2963
|
this.expectedAdBreakDurationMs = void 0;
|
|
2921
2964
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
2922
|
-
this.
|
|
2923
|
-
|
|
2965
|
+
this.showAds = false;
|
|
2966
|
+
this.adPodQueue = [];
|
|
2967
|
+
this.currentAdIndex = 0;
|
|
2968
|
+
this.totalAdsInBreak = 0;
|
|
2969
|
+
this.clearAdFailsafeTimer();
|
|
2970
|
+
if (adPlaying) {
|
|
2924
2971
|
this.ima.stop().catch(() => {
|
|
2925
2972
|
});
|
|
2973
|
+
return;
|
|
2974
|
+
}
|
|
2975
|
+
const originalMutedState = this.ima.getOriginalMutedState();
|
|
2976
|
+
if (this.video.muted !== originalMutedState) {
|
|
2977
|
+
this.video.muted = originalMutedState;
|
|
2926
2978
|
}
|
|
2927
2979
|
}
|
|
2928
2980
|
scheduleAdStartIn(delayMs) {
|