stormcloud-video-player 0.5.5 → 0.5.7

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.
Files changed (39) hide show
  1. package/README.md +28 -40
  2. package/dist/stormcloud-vp.min.js +1 -1
  3. package/lib/index.cjs +1075 -3918
  4. package/lib/index.cjs.map +1 -1
  5. package/lib/index.d.cts +8 -67
  6. package/lib/index.d.ts +8 -67
  7. package/lib/index.js +1076 -3903
  8. package/lib/index.js.map +1 -1
  9. package/lib/player/StormcloudVideoPlayer.cjs +1063 -3876
  10. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  11. package/lib/player/StormcloudVideoPlayer.d.cts +4 -37
  12. package/lib/players/HlsPlayer.cjs +1063 -3876
  13. package/lib/players/HlsPlayer.cjs.map +1 -1
  14. package/lib/players/HlsPlayer.d.cts +1 -1
  15. package/lib/players/index.cjs +1063 -3876
  16. package/lib/players/index.cjs.map +1 -1
  17. package/lib/sdk/prebid.cjs +114 -43
  18. package/lib/sdk/prebid.cjs.map +1 -1
  19. package/lib/sdk/prebid.d.cts +1 -1
  20. package/lib/sdk/prebidController.cjs +124 -71
  21. package/lib/sdk/prebidController.cjs.map +1 -1
  22. package/lib/sdk/prebidController.d.cts +2 -2
  23. package/lib/{types-CRi_KrjM.d.cts → types-BOJiWNWa.d.cts} +23 -7
  24. package/lib/ui/StormcloudVideoPlayer.cjs +1063 -3886
  25. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  26. package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
  27. package/lib/utils/browserCompat.cjs +0 -3
  28. package/lib/utils/browserCompat.cjs.map +1 -1
  29. package/lib/utils/browserCompat.d.cts +0 -1
  30. package/lib/utils/tracking.cjs +226 -1
  31. package/lib/utils/tracking.cjs.map +1 -1
  32. package/lib/utils/tracking.d.cts +5 -2
  33. package/package.json +1 -1
  34. package/lib/sdk/hlsAdPlayer.cjs +0 -1052
  35. package/lib/sdk/hlsAdPlayer.cjs.map +0 -1
  36. package/lib/sdk/hlsAdPlayer.d.cts +0 -10
  37. package/lib/sdk/ima.cjs +0 -1383
  38. package/lib/sdk/ima.cjs.map +0 -1
  39. package/lib/sdk/ima.d.cts +0 -12
package/lib/index.d.cts CHANGED
@@ -7,7 +7,6 @@ interface AdBreak {
7
7
  id?: string;
8
8
  startTimeMs: number;
9
9
  durationMs?: number;
10
- vastTagUrl?: string;
11
10
  }
12
11
  interface AdSchedule {
13
12
  breaks: AdBreak[];
@@ -32,14 +31,11 @@ interface StormcloudVideoPlayerConfig {
32
31
  onFullscreenToggle?: () => void;
33
32
  onControlClick?: () => void;
34
33
  licenseKey?: string;
35
- adPlayerType?: 'ima' | 'hls' | 'prebid';
36
- vastTagUrl?: string;
37
- vastMode?: 'adstorm' | 'default';
38
34
  minSegmentsBeforePlay?: number;
39
35
  }
40
- interface ImaController {
36
+ interface AdController {
41
37
  initialize: () => void;
42
- requestAds: (vastTagUrl: string) => Promise<void>;
38
+ requestAds: () => Promise<void>;
43
39
  play: () => Promise<void>;
44
40
  pause: () => void;
45
41
  resume: () => void;
@@ -57,10 +53,6 @@ interface ImaController {
57
53
  showPlaceholder: () => void;
58
54
  hidePlaceholder: () => void;
59
55
  }
60
- interface ImaControllerOptions {
61
- maxRetries?: number;
62
- backoffBaseMs?: number;
63
- }
64
56
  interface ClientInfo {
65
57
  brand: string;
66
58
  os: string;
@@ -117,7 +109,7 @@ interface PrebidBidResponse {
117
109
  interface PrebidManager {
118
110
  initialize: () => Promise<void>;
119
111
  requestBids: () => Promise<PrebidBidResponse[]>;
120
- getVastUrl: () => Promise<string | null>;
112
+ requestBidsUntilResponse: () => Promise<PrebidBidResponse[]>;
121
113
  destroy: () => void;
122
114
  readonly isInitialized: boolean;
123
115
  }
@@ -126,7 +118,7 @@ declare class StormcloudVideoPlayer {
126
118
  private readonly video;
127
119
  private readonly config;
128
120
  private hls?;
129
- private ima;
121
+ private adController;
130
122
  private attached;
131
123
  private inAdBreak;
132
124
  private currentAdBreakStartWallClockMs;
@@ -136,8 +128,6 @@ declare class StormcloudVideoPlayer {
136
128
  private adFailsafeTimerId;
137
129
  private ptsDriftEmaMs;
138
130
  private adPodQueue;
139
- private apiVastTagUrl;
140
- private apiNumberAds;
141
131
  private lastHeartbeatTime;
142
132
  private heartbeatInterval;
143
133
  private currentAdIndex;
@@ -154,9 +144,6 @@ declare class StormcloudVideoPlayer {
154
144
  private adRequestWatchdogId;
155
145
  private adRequestWatchdogToken;
156
146
  private adFailsafeToken;
157
- private failedVastUrls;
158
- private temporaryFailureUrls;
159
- private readonly temporaryFailureCooldownMs;
160
147
  private continuousFetchingActive;
161
148
  private adRequestQueue;
162
149
  private maxPlaceholderDurationMs;
@@ -173,19 +160,12 @@ declare class StormcloudVideoPlayer {
173
160
  private readonly minAdRequestIntervalMs;
174
161
  private readonly backoffBaseMs;
175
162
  private readonly maxBackoffMs;
176
- private readonly continuousFetchWallClockBufferMs;
177
- private readonly continuousFetchMaxIterations;
178
- private continuousFetchQueueFullConsecutiveWaits;
179
163
  private placeholderContainer;
180
- private preloadPool;
181
- private readonly maxPreloadPoolSize;
182
- private preloadPoolActive;
183
- private preloadPoolLoopRunning;
184
164
  constructor(config: StormcloudVideoPlayerConfig);
185
165
  private createAdPlayer;
186
- private getAdPlayerTypeLabel;
187
166
  load(): Promise<void>;
188
- private attachImaEventListeners;
167
+ private getAdSource;
168
+ private attachAdControllerEventListeners;
189
169
  private recreateAdController;
190
170
  private ensurePlaceholderContainer;
191
171
  private showPlaceholderLayer;
@@ -204,12 +184,8 @@ declare class StormcloudVideoPlayer {
204
184
  private parseScte35Binary;
205
185
  private initializeTracking;
206
186
  private sendHeartbeatIfNeeded;
207
- private fetchAdConfiguration;
208
- private isPrebidMode;
209
- private isLgStbDevice;
210
187
  getCurrentAdIndex(): number;
211
188
  getTotalAdsInBreak(): number;
212
- private generateVastUrlsWithCorrelators;
213
189
  isAdPlaying(): boolean;
214
190
  isShowingAds(): boolean;
215
191
  getStreamType(): "hls" | "other";
@@ -217,33 +193,18 @@ declare class StormcloudVideoPlayer {
217
193
  private shouldContinueLiveStreamDuringAds;
218
194
  private startAdPrefetch;
219
195
  private clearPendingAdBreak;
220
- private startPreloadPool;
221
- private preloadAdIntoPool;
222
- private preloadPoolLoop;
223
- private getPreloadedAd;
224
- private stopPreloadPool;
225
196
  private handleAdStart;
226
- private continuousFetchLoopRunning;
227
- private startContinuousFetching;
228
- private continuousFetchLoop;
229
- private waitForQueueWithBackoff;
230
- private logQueueState;
231
197
  private stopContinuousFetching;
232
198
  private tryNextAvailableAdWithRateLimit;
233
199
  private tryNextAvailableAd;
234
200
  private showPlaceholderAndWaitForAds;
235
- private findCurrentOrNextBreak;
236
201
  private onTimeUpdate;
237
- private handleMidAdJoin;
238
202
  private scheduleAdStopCountdown;
239
203
  private clearAdStopTimer;
240
204
  private ensureAdStoppedByTimer;
241
205
  private scheduleAdStartIn;
242
206
  private clearAdStartTimer;
243
207
  private updatePtsDrift;
244
- private isTemporaryAdError;
245
- private isUrlInCooldown;
246
- private cleanupTemporaryFailures;
247
208
  private playSingleAd;
248
209
  private handleAdPodComplete;
249
210
  private handleAdFailure;
@@ -251,10 +212,8 @@ declare class StormcloudVideoPlayer {
251
212
  private clearAdRequestWatchdog;
252
213
  private startAdFailsafeTimer;
253
214
  private clearAdFailsafeTimer;
254
- private selectVastTagsForBreak;
255
215
  private logAdState;
256
216
  private getRemainingAdMs;
257
- private findBreakForTime;
258
217
  toggleMute(): void;
259
218
  toggleFullscreen(): Promise<void>;
260
219
  isMuted(): boolean;
@@ -4029,31 +3988,13 @@ interface BrowserInfo {
4029
3988
  chromeVersion?: number | undefined;
4030
3989
  }
4031
3990
  declare function detectBrowser(): BrowserInfo;
4032
- declare function supportsGoogleIMA(): boolean;
4033
- declare function getRecommendedAdPlayer(): 'ima' | 'hls';
4034
3991
  declare function supportsModernJS(): boolean;
4035
3992
  declare function logBrowserInfo(debug?: boolean): void;
4036
3993
  declare function getBrowserConfigOverrides(): {
4037
- adPlayerType?: 'ima' | 'hls';
4038
3994
  allowNativeHls?: boolean;
4039
3995
  };
4040
3996
  declare function supportsFeature(feature: string): boolean;
4041
3997
 
4042
- declare global {
4043
- interface Window {
4044
- google?: any;
4045
- }
4046
- }
4047
- declare function createImaController(video: HTMLVideoElement, options?: {
4048
- continueLiveStreamDuringAds?: boolean;
4049
- }): ImaController;
4050
-
4051
- declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
4052
- continueLiveStreamDuringAds?: boolean;
4053
- licenseKey?: string;
4054
- mainHlsInstance?: Hls;
4055
- }): ImaController;
4056
-
4057
3998
  interface PrebidManagerOptions {
4058
3999
  debug?: boolean;
4059
4000
  }
@@ -4065,6 +4006,6 @@ interface PrebidControllerOptions {
4065
4006
  mainHlsInstance?: Hls;
4066
4007
  debug?: boolean;
4067
4008
  }
4068
- declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): ImaController;
4009
+ declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): AdController;
4069
4010
 
4070
- export { type AdBreak, type AdSchedule, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type ImaController, type ImaControllerOptions, type LateJoinPolicy, type OnProgressProps, type PrebidBidResponse, type PrebidControllerOptions, type PrebidManager, type PrebidManagerOptions, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type TrackingData, canPlay, createHlsAdPlayer, createImaController, createPrebidController, createPrebidManager, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, getRecommendedAdPlayer, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsGoogleIMA, supportsModernJS, supportsWebKitPresentationMode };
4011
+ export { type AdBreak, type AdController, type AdSchedule, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type LateJoinPolicy, type OnProgressProps, type PrebidBidResponse, type PrebidControllerOptions, type PrebidManager, type PrebidManagerOptions, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type TrackingData, canPlay, createPrebidController, createPrebidManager, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode };
package/lib/index.d.ts CHANGED
@@ -7,7 +7,6 @@ interface AdBreak {
7
7
  id?: string;
8
8
  startTimeMs: number;
9
9
  durationMs?: number;
10
- vastTagUrl?: string;
11
10
  }
12
11
  interface AdSchedule {
13
12
  breaks: AdBreak[];
@@ -32,14 +31,11 @@ interface StormcloudVideoPlayerConfig {
32
31
  onFullscreenToggle?: () => void;
33
32
  onControlClick?: () => void;
34
33
  licenseKey?: string;
35
- adPlayerType?: 'ima' | 'hls' | 'prebid';
36
- vastTagUrl?: string;
37
- vastMode?: 'adstorm' | 'default';
38
34
  minSegmentsBeforePlay?: number;
39
35
  }
40
- interface ImaController {
36
+ interface AdController {
41
37
  initialize: () => void;
42
- requestAds: (vastTagUrl: string) => Promise<void>;
38
+ requestAds: () => Promise<void>;
43
39
  play: () => Promise<void>;
44
40
  pause: () => void;
45
41
  resume: () => void;
@@ -57,10 +53,6 @@ interface ImaController {
57
53
  showPlaceholder: () => void;
58
54
  hidePlaceholder: () => void;
59
55
  }
60
- interface ImaControllerOptions {
61
- maxRetries?: number;
62
- backoffBaseMs?: number;
63
- }
64
56
  interface ClientInfo {
65
57
  brand: string;
66
58
  os: string;
@@ -117,7 +109,7 @@ interface PrebidBidResponse {
117
109
  interface PrebidManager {
118
110
  initialize: () => Promise<void>;
119
111
  requestBids: () => Promise<PrebidBidResponse[]>;
120
- getVastUrl: () => Promise<string | null>;
112
+ requestBidsUntilResponse: () => Promise<PrebidBidResponse[]>;
121
113
  destroy: () => void;
122
114
  readonly isInitialized: boolean;
123
115
  }
@@ -126,7 +118,7 @@ declare class StormcloudVideoPlayer {
126
118
  private readonly video;
127
119
  private readonly config;
128
120
  private hls?;
129
- private ima;
121
+ private adController;
130
122
  private attached;
131
123
  private inAdBreak;
132
124
  private currentAdBreakStartWallClockMs;
@@ -136,8 +128,6 @@ declare class StormcloudVideoPlayer {
136
128
  private adFailsafeTimerId;
137
129
  private ptsDriftEmaMs;
138
130
  private adPodQueue;
139
- private apiVastTagUrl;
140
- private apiNumberAds;
141
131
  private lastHeartbeatTime;
142
132
  private heartbeatInterval;
143
133
  private currentAdIndex;
@@ -154,9 +144,6 @@ declare class StormcloudVideoPlayer {
154
144
  private adRequestWatchdogId;
155
145
  private adRequestWatchdogToken;
156
146
  private adFailsafeToken;
157
- private failedVastUrls;
158
- private temporaryFailureUrls;
159
- private readonly temporaryFailureCooldownMs;
160
147
  private continuousFetchingActive;
161
148
  private adRequestQueue;
162
149
  private maxPlaceholderDurationMs;
@@ -173,19 +160,12 @@ declare class StormcloudVideoPlayer {
173
160
  private readonly minAdRequestIntervalMs;
174
161
  private readonly backoffBaseMs;
175
162
  private readonly maxBackoffMs;
176
- private readonly continuousFetchWallClockBufferMs;
177
- private readonly continuousFetchMaxIterations;
178
- private continuousFetchQueueFullConsecutiveWaits;
179
163
  private placeholderContainer;
180
- private preloadPool;
181
- private readonly maxPreloadPoolSize;
182
- private preloadPoolActive;
183
- private preloadPoolLoopRunning;
184
164
  constructor(config: StormcloudVideoPlayerConfig);
185
165
  private createAdPlayer;
186
- private getAdPlayerTypeLabel;
187
166
  load(): Promise<void>;
188
- private attachImaEventListeners;
167
+ private getAdSource;
168
+ private attachAdControllerEventListeners;
189
169
  private recreateAdController;
190
170
  private ensurePlaceholderContainer;
191
171
  private showPlaceholderLayer;
@@ -204,12 +184,8 @@ declare class StormcloudVideoPlayer {
204
184
  private parseScte35Binary;
205
185
  private initializeTracking;
206
186
  private sendHeartbeatIfNeeded;
207
- private fetchAdConfiguration;
208
- private isPrebidMode;
209
- private isLgStbDevice;
210
187
  getCurrentAdIndex(): number;
211
188
  getTotalAdsInBreak(): number;
212
- private generateVastUrlsWithCorrelators;
213
189
  isAdPlaying(): boolean;
214
190
  isShowingAds(): boolean;
215
191
  getStreamType(): "hls" | "other";
@@ -217,33 +193,18 @@ declare class StormcloudVideoPlayer {
217
193
  private shouldContinueLiveStreamDuringAds;
218
194
  private startAdPrefetch;
219
195
  private clearPendingAdBreak;
220
- private startPreloadPool;
221
- private preloadAdIntoPool;
222
- private preloadPoolLoop;
223
- private getPreloadedAd;
224
- private stopPreloadPool;
225
196
  private handleAdStart;
226
- private continuousFetchLoopRunning;
227
- private startContinuousFetching;
228
- private continuousFetchLoop;
229
- private waitForQueueWithBackoff;
230
- private logQueueState;
231
197
  private stopContinuousFetching;
232
198
  private tryNextAvailableAdWithRateLimit;
233
199
  private tryNextAvailableAd;
234
200
  private showPlaceholderAndWaitForAds;
235
- private findCurrentOrNextBreak;
236
201
  private onTimeUpdate;
237
- private handleMidAdJoin;
238
202
  private scheduleAdStopCountdown;
239
203
  private clearAdStopTimer;
240
204
  private ensureAdStoppedByTimer;
241
205
  private scheduleAdStartIn;
242
206
  private clearAdStartTimer;
243
207
  private updatePtsDrift;
244
- private isTemporaryAdError;
245
- private isUrlInCooldown;
246
- private cleanupTemporaryFailures;
247
208
  private playSingleAd;
248
209
  private handleAdPodComplete;
249
210
  private handleAdFailure;
@@ -251,10 +212,8 @@ declare class StormcloudVideoPlayer {
251
212
  private clearAdRequestWatchdog;
252
213
  private startAdFailsafeTimer;
253
214
  private clearAdFailsafeTimer;
254
- private selectVastTagsForBreak;
255
215
  private logAdState;
256
216
  private getRemainingAdMs;
257
- private findBreakForTime;
258
217
  toggleMute(): void;
259
218
  toggleFullscreen(): Promise<void>;
260
219
  isMuted(): boolean;
@@ -4029,31 +3988,13 @@ interface BrowserInfo {
4029
3988
  chromeVersion?: number | undefined;
4030
3989
  }
4031
3990
  declare function detectBrowser(): BrowserInfo;
4032
- declare function supportsGoogleIMA(): boolean;
4033
- declare function getRecommendedAdPlayer(): 'ima' | 'hls';
4034
3991
  declare function supportsModernJS(): boolean;
4035
3992
  declare function logBrowserInfo(debug?: boolean): void;
4036
3993
  declare function getBrowserConfigOverrides(): {
4037
- adPlayerType?: 'ima' | 'hls';
4038
3994
  allowNativeHls?: boolean;
4039
3995
  };
4040
3996
  declare function supportsFeature(feature: string): boolean;
4041
3997
 
4042
- declare global {
4043
- interface Window {
4044
- google?: any;
4045
- }
4046
- }
4047
- declare function createImaController(video: HTMLVideoElement, options?: {
4048
- continueLiveStreamDuringAds?: boolean;
4049
- }): ImaController;
4050
-
4051
- declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
4052
- continueLiveStreamDuringAds?: boolean;
4053
- licenseKey?: string;
4054
- mainHlsInstance?: Hls;
4055
- }): ImaController;
4056
-
4057
3998
  interface PrebidManagerOptions {
4058
3999
  debug?: boolean;
4059
4000
  }
@@ -4065,6 +4006,6 @@ interface PrebidControllerOptions {
4065
4006
  mainHlsInstance?: Hls;
4066
4007
  debug?: boolean;
4067
4008
  }
4068
- declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): ImaController;
4009
+ declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): AdController;
4069
4010
 
4070
- export { type AdBreak, type AdSchedule, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type ImaController, type ImaControllerOptions, type LateJoinPolicy, type OnProgressProps, type PrebidBidResponse, type PrebidControllerOptions, type PrebidManager, type PrebidManagerOptions, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type TrackingData, canPlay, createHlsAdPlayer, createImaController, createPrebidController, createPrebidManager, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, getRecommendedAdPlayer, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsGoogleIMA, supportsModernJS, supportsWebKitPresentationMode };
4011
+ export { type AdBreak, type AdController, type AdSchedule, type BaseStormcloudPlayerProps, type BrowserInfo, type ClientInfo, type HeartbeatData, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, type LateJoinPolicy, type OnProgressProps, type PrebidBidResponse, type PrebidControllerOptions, type PrebidManager, type PrebidManagerOptions, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, type StormcloudVideoPlayerConfig, type StormcloudVideoPlayerProps, type TrackingData, canPlay, createPrebidController, createPrebidManager, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode };