stormcloud-video-player 0.5.6 → 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 (37) hide show
  1. package/README.md +28 -40
  2. package/dist/stormcloud-vp.min.js +1 -1
  3. package/lib/index.cjs +1537 -4636
  4. package/lib/index.cjs.map +1 -1
  5. package/lib/index.d.cts +7 -67
  6. package/lib/index.d.ts +7 -67
  7. package/lib/index.js +1540 -4623
  8. package/lib/index.js.map +1 -1
  9. package/lib/player/StormcloudVideoPlayer.cjs +811 -3880
  10. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  11. package/lib/player/StormcloudVideoPlayer.d.cts +3 -37
  12. package/lib/players/HlsPlayer.cjs +811 -3880
  13. package/lib/players/HlsPlayer.cjs.map +1 -1
  14. package/lib/players/HlsPlayer.d.cts +1 -1
  15. package/lib/players/index.cjs +811 -3880
  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 +123 -71
  21. package/lib/sdk/prebidController.cjs.map +1 -1
  22. package/lib/sdk/prebidController.d.cts +2 -2
  23. package/lib/{types-Bwp6-yys.d.cts → types-BOJiWNWa.d.cts} +4 -7
  24. package/lib/ui/StormcloudVideoPlayer.cjs +811 -3890
  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.d.cts +1 -1
  31. package/package.json +1 -1
  32. package/lib/sdk/hlsAdPlayer.cjs +0 -1053
  33. package/lib/sdk/hlsAdPlayer.cjs.map +0 -1
  34. package/lib/sdk/hlsAdPlayer.d.cts +0 -10
  35. package/lib/sdk/ima.cjs +0 -1384
  36. package/lib/sdk/ima.cjs.map +0 -1
  37. 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,20 +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
167
  private getAdSource;
189
- private attachImaEventListeners;
168
+ private attachAdControllerEventListeners;
190
169
  private recreateAdController;
191
170
  private ensurePlaceholderContainer;
192
171
  private showPlaceholderLayer;
@@ -205,12 +184,8 @@ declare class StormcloudVideoPlayer {
205
184
  private parseScte35Binary;
206
185
  private initializeTracking;
207
186
  private sendHeartbeatIfNeeded;
208
- private fetchAdConfiguration;
209
- private isPrebidMode;
210
- private isLgStbDevice;
211
187
  getCurrentAdIndex(): number;
212
188
  getTotalAdsInBreak(): number;
213
- private generateVastUrlsWithCorrelators;
214
189
  isAdPlaying(): boolean;
215
190
  isShowingAds(): boolean;
216
191
  getStreamType(): "hls" | "other";
@@ -218,33 +193,18 @@ declare class StormcloudVideoPlayer {
218
193
  private shouldContinueLiveStreamDuringAds;
219
194
  private startAdPrefetch;
220
195
  private clearPendingAdBreak;
221
- private startPreloadPool;
222
- private preloadAdIntoPool;
223
- private preloadPoolLoop;
224
- private getPreloadedAd;
225
- private stopPreloadPool;
226
196
  private handleAdStart;
227
- private continuousFetchLoopRunning;
228
- private startContinuousFetching;
229
- private continuousFetchLoop;
230
- private waitForQueueWithBackoff;
231
- private logQueueState;
232
197
  private stopContinuousFetching;
233
198
  private tryNextAvailableAdWithRateLimit;
234
199
  private tryNextAvailableAd;
235
200
  private showPlaceholderAndWaitForAds;
236
- private findCurrentOrNextBreak;
237
201
  private onTimeUpdate;
238
- private handleMidAdJoin;
239
202
  private scheduleAdStopCountdown;
240
203
  private clearAdStopTimer;
241
204
  private ensureAdStoppedByTimer;
242
205
  private scheduleAdStartIn;
243
206
  private clearAdStartTimer;
244
207
  private updatePtsDrift;
245
- private isTemporaryAdError;
246
- private isUrlInCooldown;
247
- private cleanupTemporaryFailures;
248
208
  private playSingleAd;
249
209
  private handleAdPodComplete;
250
210
  private handleAdFailure;
@@ -252,10 +212,8 @@ declare class StormcloudVideoPlayer {
252
212
  private clearAdRequestWatchdog;
253
213
  private startAdFailsafeTimer;
254
214
  private clearAdFailsafeTimer;
255
- private selectVastTagsForBreak;
256
215
  private logAdState;
257
216
  private getRemainingAdMs;
258
- private findBreakForTime;
259
217
  toggleMute(): void;
260
218
  toggleFullscreen(): Promise<void>;
261
219
  isMuted(): boolean;
@@ -4030,31 +3988,13 @@ interface BrowserInfo {
4030
3988
  chromeVersion?: number | undefined;
4031
3989
  }
4032
3990
  declare function detectBrowser(): BrowserInfo;
4033
- declare function supportsGoogleIMA(): boolean;
4034
- declare function getRecommendedAdPlayer(): 'ima' | 'hls';
4035
3991
  declare function supportsModernJS(): boolean;
4036
3992
  declare function logBrowserInfo(debug?: boolean): void;
4037
3993
  declare function getBrowserConfigOverrides(): {
4038
- adPlayerType?: 'ima' | 'hls';
4039
3994
  allowNativeHls?: boolean;
4040
3995
  };
4041
3996
  declare function supportsFeature(feature: string): boolean;
4042
3997
 
4043
- declare global {
4044
- interface Window {
4045
- google?: any;
4046
- }
4047
- }
4048
- declare function createImaController(video: HTMLVideoElement, options?: {
4049
- continueLiveStreamDuringAds?: boolean;
4050
- }): ImaController;
4051
-
4052
- declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
4053
- continueLiveStreamDuringAds?: boolean;
4054
- licenseKey?: string;
4055
- mainHlsInstance?: Hls;
4056
- }): ImaController;
4057
-
4058
3998
  interface PrebidManagerOptions {
4059
3999
  debug?: boolean;
4060
4000
  }
@@ -4066,6 +4006,6 @@ interface PrebidControllerOptions {
4066
4006
  mainHlsInstance?: Hls;
4067
4007
  debug?: boolean;
4068
4008
  }
4069
- declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): ImaController;
4009
+ declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): AdController;
4070
4010
 
4071
- 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,20 +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
167
  private getAdSource;
189
- private attachImaEventListeners;
168
+ private attachAdControllerEventListeners;
190
169
  private recreateAdController;
191
170
  private ensurePlaceholderContainer;
192
171
  private showPlaceholderLayer;
@@ -205,12 +184,8 @@ declare class StormcloudVideoPlayer {
205
184
  private parseScte35Binary;
206
185
  private initializeTracking;
207
186
  private sendHeartbeatIfNeeded;
208
- private fetchAdConfiguration;
209
- private isPrebidMode;
210
- private isLgStbDevice;
211
187
  getCurrentAdIndex(): number;
212
188
  getTotalAdsInBreak(): number;
213
- private generateVastUrlsWithCorrelators;
214
189
  isAdPlaying(): boolean;
215
190
  isShowingAds(): boolean;
216
191
  getStreamType(): "hls" | "other";
@@ -218,33 +193,18 @@ declare class StormcloudVideoPlayer {
218
193
  private shouldContinueLiveStreamDuringAds;
219
194
  private startAdPrefetch;
220
195
  private clearPendingAdBreak;
221
- private startPreloadPool;
222
- private preloadAdIntoPool;
223
- private preloadPoolLoop;
224
- private getPreloadedAd;
225
- private stopPreloadPool;
226
196
  private handleAdStart;
227
- private continuousFetchLoopRunning;
228
- private startContinuousFetching;
229
- private continuousFetchLoop;
230
- private waitForQueueWithBackoff;
231
- private logQueueState;
232
197
  private stopContinuousFetching;
233
198
  private tryNextAvailableAdWithRateLimit;
234
199
  private tryNextAvailableAd;
235
200
  private showPlaceholderAndWaitForAds;
236
- private findCurrentOrNextBreak;
237
201
  private onTimeUpdate;
238
- private handleMidAdJoin;
239
202
  private scheduleAdStopCountdown;
240
203
  private clearAdStopTimer;
241
204
  private ensureAdStoppedByTimer;
242
205
  private scheduleAdStartIn;
243
206
  private clearAdStartTimer;
244
207
  private updatePtsDrift;
245
- private isTemporaryAdError;
246
- private isUrlInCooldown;
247
- private cleanupTemporaryFailures;
248
208
  private playSingleAd;
249
209
  private handleAdPodComplete;
250
210
  private handleAdFailure;
@@ -252,10 +212,8 @@ declare class StormcloudVideoPlayer {
252
212
  private clearAdRequestWatchdog;
253
213
  private startAdFailsafeTimer;
254
214
  private clearAdFailsafeTimer;
255
- private selectVastTagsForBreak;
256
215
  private logAdState;
257
216
  private getRemainingAdMs;
258
- private findBreakForTime;
259
217
  toggleMute(): void;
260
218
  toggleFullscreen(): Promise<void>;
261
219
  isMuted(): boolean;
@@ -4030,31 +3988,13 @@ interface BrowserInfo {
4030
3988
  chromeVersion?: number | undefined;
4031
3989
  }
4032
3990
  declare function detectBrowser(): BrowserInfo;
4033
- declare function supportsGoogleIMA(): boolean;
4034
- declare function getRecommendedAdPlayer(): 'ima' | 'hls';
4035
3991
  declare function supportsModernJS(): boolean;
4036
3992
  declare function logBrowserInfo(debug?: boolean): void;
4037
3993
  declare function getBrowserConfigOverrides(): {
4038
- adPlayerType?: 'ima' | 'hls';
4039
3994
  allowNativeHls?: boolean;
4040
3995
  };
4041
3996
  declare function supportsFeature(feature: string): boolean;
4042
3997
 
4043
- declare global {
4044
- interface Window {
4045
- google?: any;
4046
- }
4047
- }
4048
- declare function createImaController(video: HTMLVideoElement, options?: {
4049
- continueLiveStreamDuringAds?: boolean;
4050
- }): ImaController;
4051
-
4052
- declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
4053
- continueLiveStreamDuringAds?: boolean;
4054
- licenseKey?: string;
4055
- mainHlsInstance?: Hls;
4056
- }): ImaController;
4057
-
4058
3998
  interface PrebidManagerOptions {
4059
3999
  debug?: boolean;
4060
4000
  }
@@ -4066,6 +4006,6 @@ interface PrebidControllerOptions {
4066
4006
  mainHlsInstance?: Hls;
4067
4007
  debug?: boolean;
4068
4008
  }
4069
- declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): ImaController;
4009
+ declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): AdController;
4070
4010
 
4071
- 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 };