stormcloud-video-player 0.4.0 → 0.5.0
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/README.md +245 -156
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +9759 -5311
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +193 -17
- package/lib/index.d.ts +193 -17
- package/lib/index.js +9761 -5329
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +7090 -1508
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +95 -9
- package/lib/players/HlsPlayer.cjs +7107 -1525
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +7098 -1516
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +302 -266
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +2 -2
- package/lib/sdk/ima.cjs +1375 -0
- package/lib/sdk/ima.cjs.map +1 -0
- package/lib/sdk/ima.d.cts +12 -0
- package/lib/sdk/prebid.cjs +564 -0
- package/lib/sdk/prebid.cjs.map +1 -0
- package/lib/sdk/prebid.d.cts +5 -0
- package/lib/sdk/prebidController.cjs +1560 -0
- package/lib/sdk/prebidController.cjs.map +1 -0
- package/lib/sdk/prebidController.d.cts +11 -0
- package/lib/sdk/vastParser.cjs +393 -0
- package/lib/sdk/vastParser.cjs.map +1 -0
- package/lib/sdk/vastParser.d.cts +45 -0
- package/lib/{types-Ca4ZDaWw.d.cts → types-g2d4Akez.d.cts} +72 -3
- package/lib/ui/StormcloudVideoPlayer.cjs +7130 -1530
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/browserCompat.cjs +222 -20
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/browserCompat.d.cts +9 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +2 -1
- package/lib/sdk/adstormPlayer.cjs +0 -908
- package/lib/sdk/adstormPlayer.cjs.map +0 -1
- package/lib/sdk/adstormPlayer.d.cts +0 -9
package/lib/index.d.cts
CHANGED
|
@@ -7,6 +7,7 @@ interface AdBreak {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
startTimeMs: number;
|
|
9
9
|
durationMs?: number;
|
|
10
|
+
vastTagUrl?: string;
|
|
10
11
|
}
|
|
11
12
|
interface AdSchedule {
|
|
12
13
|
breaks: AdBreak[];
|
|
@@ -31,12 +32,18 @@ interface StormcloudVideoPlayerConfig {
|
|
|
31
32
|
onFullscreenToggle?: () => void;
|
|
32
33
|
onControlClick?: () => void;
|
|
33
34
|
licenseKey?: string;
|
|
35
|
+
adPlayerType?: 'ima' | 'hls' | 'prebid';
|
|
36
|
+
vastTagUrl?: string;
|
|
37
|
+
vastMode?: 'adstorm' | 'default';
|
|
34
38
|
minSegmentsBeforePlay?: number;
|
|
39
|
+
prebid?: PrebidConfig;
|
|
35
40
|
}
|
|
36
|
-
interface
|
|
41
|
+
interface ImaController {
|
|
37
42
|
initialize: () => void;
|
|
38
|
-
requestAds: (
|
|
43
|
+
requestAds: (vastTagUrl: string) => Promise<void>;
|
|
39
44
|
play: () => Promise<void>;
|
|
45
|
+
pause: () => void;
|
|
46
|
+
resume: () => void;
|
|
40
47
|
stop: () => Promise<void>;
|
|
41
48
|
destroy: () => void;
|
|
42
49
|
isAdPlaying: () => boolean;
|
|
@@ -51,7 +58,7 @@ interface AdController {
|
|
|
51
58
|
showPlaceholder: () => void;
|
|
52
59
|
hidePlaceholder: () => void;
|
|
53
60
|
}
|
|
54
|
-
interface
|
|
61
|
+
interface ImaControllerOptions {
|
|
55
62
|
maxRetries?: number;
|
|
56
63
|
backoffBaseMs?: number;
|
|
57
64
|
}
|
|
@@ -95,58 +102,207 @@ interface HeartbeatData {
|
|
|
95
102
|
browserId: string;
|
|
96
103
|
timestamp: string;
|
|
97
104
|
}
|
|
105
|
+
interface PrebidServerImpVideo {
|
|
106
|
+
w?: number;
|
|
107
|
+
h?: number;
|
|
108
|
+
mimes?: string[];
|
|
109
|
+
placement?: number;
|
|
110
|
+
protocols?: number[];
|
|
111
|
+
minduration?: number;
|
|
112
|
+
maxduration?: number;
|
|
113
|
+
linearity?: number;
|
|
114
|
+
skip?: number;
|
|
115
|
+
playbackmethod?: number[];
|
|
116
|
+
api?: number[];
|
|
117
|
+
}
|
|
118
|
+
interface PrebidServerImp {
|
|
119
|
+
id: string;
|
|
120
|
+
instl?: number;
|
|
121
|
+
video?: PrebidServerImpVideo;
|
|
122
|
+
banner?: {
|
|
123
|
+
w?: number;
|
|
124
|
+
h?: number;
|
|
125
|
+
format?: Array<{
|
|
126
|
+
w: number;
|
|
127
|
+
h: number;
|
|
128
|
+
}>;
|
|
129
|
+
};
|
|
130
|
+
ext?: Record<string, any>;
|
|
131
|
+
}
|
|
132
|
+
interface PrebidServerRequest {
|
|
133
|
+
id: string;
|
|
134
|
+
site?: Record<string, any>;
|
|
135
|
+
device?: Record<string, any>;
|
|
136
|
+
imp: PrebidServerImp[];
|
|
137
|
+
tmax?: number;
|
|
138
|
+
ext?: Record<string, any>;
|
|
139
|
+
}
|
|
140
|
+
interface PrebidConfig {
|
|
141
|
+
enabled?: boolean;
|
|
142
|
+
serverUrl?: string;
|
|
143
|
+
ortbRequest: PrebidServerRequest;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
debug?: boolean;
|
|
146
|
+
cpmFloor?: number;
|
|
147
|
+
}
|
|
148
|
+
interface PrebidBidResponse {
|
|
149
|
+
bidder: string;
|
|
150
|
+
cpm: number;
|
|
151
|
+
vastUrl?: string;
|
|
152
|
+
vastXml?: string;
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
adId: string;
|
|
156
|
+
impId: string;
|
|
157
|
+
creativeId: string;
|
|
158
|
+
currency: string;
|
|
159
|
+
adomain?: string[];
|
|
160
|
+
}
|
|
161
|
+
interface PrebidManager {
|
|
162
|
+
initialize: () => Promise<void>;
|
|
163
|
+
requestBids: () => Promise<PrebidBidResponse[]>;
|
|
164
|
+
getVastUrl: () => Promise<string | null>;
|
|
165
|
+
destroy: () => void;
|
|
166
|
+
readonly isInitialized: boolean;
|
|
167
|
+
}
|
|
98
168
|
|
|
99
169
|
declare class StormcloudVideoPlayer {
|
|
100
170
|
private readonly video;
|
|
101
171
|
private readonly config;
|
|
102
172
|
private hls?;
|
|
103
|
-
private
|
|
173
|
+
private ima;
|
|
104
174
|
private attached;
|
|
105
175
|
private inAdBreak;
|
|
176
|
+
private currentAdBreakStartWallClockMs;
|
|
106
177
|
private expectedAdBreakDurationMs;
|
|
107
178
|
private adStopTimerId;
|
|
179
|
+
private adStartTimerId;
|
|
180
|
+
private adFailsafeTimerId;
|
|
108
181
|
private ptsDriftEmaMs;
|
|
182
|
+
private adPodQueue;
|
|
183
|
+
private apiVastTagUrl;
|
|
184
|
+
private apiNumberAds;
|
|
185
|
+
private lastHeartbeatTime;
|
|
186
|
+
private heartbeatInterval;
|
|
187
|
+
private currentAdIndex;
|
|
188
|
+
private totalAdsInBreak;
|
|
189
|
+
private showAds;
|
|
109
190
|
private isLiveStream;
|
|
110
191
|
private nativeHlsMode;
|
|
111
192
|
private videoSrcProtection;
|
|
112
193
|
private bufferedSegmentsCount;
|
|
113
194
|
private shouldAutoplayAfterBuffering;
|
|
114
195
|
private hasInitialBufferCompleted;
|
|
196
|
+
private adRequestTokenCounter;
|
|
197
|
+
private activeAdRequestToken;
|
|
198
|
+
private adRequestWatchdogId;
|
|
199
|
+
private adRequestWatchdogToken;
|
|
200
|
+
private adFailsafeToken;
|
|
201
|
+
private failedVastUrls;
|
|
202
|
+
private temporaryFailureUrls;
|
|
203
|
+
private readonly temporaryFailureCooldownMs;
|
|
204
|
+
private continuousFetchingActive;
|
|
205
|
+
private adRequestQueue;
|
|
206
|
+
private maxPlaceholderDurationMs;
|
|
207
|
+
private isShowingPlaceholder;
|
|
115
208
|
private timeUpdateHandler?;
|
|
116
209
|
private emptiedHandler?;
|
|
210
|
+
private totalAdRequestsInBreak;
|
|
211
|
+
private readonly maxTotalAdRequestsPerBreak;
|
|
212
|
+
private pendingAdBreak;
|
|
213
|
+
private prefetchTimerId;
|
|
214
|
+
private consecutiveFailures;
|
|
215
|
+
private readonly maxConsecutiveFailures;
|
|
216
|
+
private lastAdRequestTime;
|
|
217
|
+
private readonly minAdRequestIntervalMs;
|
|
218
|
+
private readonly backoffBaseMs;
|
|
219
|
+
private readonly maxBackoffMs;
|
|
220
|
+
private placeholderContainer;
|
|
221
|
+
private preloadPool;
|
|
222
|
+
private readonly maxPreloadPoolSize;
|
|
223
|
+
private preloadPoolActive;
|
|
224
|
+
private preloadPoolLoopRunning;
|
|
117
225
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
226
|
+
private createAdPlayer;
|
|
118
227
|
load(): Promise<void>;
|
|
228
|
+
private attachImaEventListeners;
|
|
229
|
+
private recreateImaController;
|
|
230
|
+
private ensurePlaceholderContainer;
|
|
231
|
+
private showPlaceholderLayer;
|
|
232
|
+
private hidePlaceholderLayer;
|
|
119
233
|
private attach;
|
|
120
234
|
private shouldUseNativeHls;
|
|
121
235
|
private onId3Tag;
|
|
122
236
|
private parseScte35FromId3;
|
|
123
237
|
private decodeId3ValueToText;
|
|
124
238
|
private onScte35Marker;
|
|
125
|
-
private handleAdStart;
|
|
126
239
|
private parseCueOutDuration;
|
|
127
240
|
private parseCueOutCont;
|
|
128
241
|
private parseAttributeList;
|
|
129
242
|
private toNumber;
|
|
130
|
-
private
|
|
131
|
-
private
|
|
132
|
-
private
|
|
133
|
-
private
|
|
243
|
+
private isManifestBasedMarker;
|
|
244
|
+
private parseScte35Binary;
|
|
245
|
+
private initializeTracking;
|
|
246
|
+
private sendHeartbeatIfNeeded;
|
|
247
|
+
private fetchAdConfiguration;
|
|
248
|
+
private isPrebidMode;
|
|
249
|
+
getCurrentAdIndex(): number;
|
|
250
|
+
getTotalAdsInBreak(): number;
|
|
251
|
+
private generateVastUrlsWithCorrelators;
|
|
134
252
|
isAdPlaying(): boolean;
|
|
135
253
|
isShowingAds(): boolean;
|
|
136
254
|
getStreamType(): "hls" | "other";
|
|
137
255
|
shouldShowNativeControls(): boolean;
|
|
256
|
+
private shouldContinueLiveStreamDuringAds;
|
|
257
|
+
private startAdPrefetch;
|
|
258
|
+
private clearPendingAdBreak;
|
|
259
|
+
private startPreloadPool;
|
|
260
|
+
private preloadAdIntoPool;
|
|
261
|
+
private preloadPoolLoop;
|
|
262
|
+
private getPreloadedAd;
|
|
263
|
+
private stopPreloadPool;
|
|
264
|
+
private handleAdStart;
|
|
265
|
+
private continuousFetchLoopRunning;
|
|
266
|
+
private startContinuousFetching;
|
|
267
|
+
private continuousFetchLoop;
|
|
268
|
+
private stopContinuousFetching;
|
|
269
|
+
private tryNextAvailableAdWithRateLimit;
|
|
270
|
+
private tryNextAvailableAd;
|
|
271
|
+
private showPlaceholderAndWaitForAds;
|
|
272
|
+
private findCurrentOrNextBreak;
|
|
273
|
+
private onTimeUpdate;
|
|
274
|
+
private handleMidAdJoin;
|
|
275
|
+
private scheduleAdStopCountdown;
|
|
276
|
+
private clearAdStopTimer;
|
|
277
|
+
private ensureAdStoppedByTimer;
|
|
278
|
+
private scheduleAdStartIn;
|
|
279
|
+
private clearAdStartTimer;
|
|
280
|
+
private updatePtsDrift;
|
|
281
|
+
private isTemporaryAdError;
|
|
282
|
+
private isUrlInCooldown;
|
|
283
|
+
private cleanupTemporaryFailures;
|
|
284
|
+
private playSingleAd;
|
|
285
|
+
private handleAdPodComplete;
|
|
286
|
+
private handleAdFailure;
|
|
287
|
+
private startAdRequestWatchdog;
|
|
288
|
+
private clearAdRequestWatchdog;
|
|
289
|
+
private startAdFailsafeTimer;
|
|
290
|
+
private clearAdFailsafeTimer;
|
|
291
|
+
private selectVastTagsForBreak;
|
|
292
|
+
private logAdState;
|
|
293
|
+
private getRemainingAdMs;
|
|
294
|
+
private findBreakForTime;
|
|
138
295
|
toggleMute(): void;
|
|
139
296
|
toggleFullscreen(): Promise<void>;
|
|
140
297
|
isMuted(): boolean;
|
|
141
298
|
setMuted(muted: boolean): void;
|
|
142
299
|
setVolume(volume: number): void;
|
|
300
|
+
getVolume(): number;
|
|
143
301
|
isFullscreen(): boolean;
|
|
144
302
|
isLive(): boolean;
|
|
145
303
|
get videoElement(): HTMLVideoElement;
|
|
146
304
|
resize(): void;
|
|
147
305
|
destroy(): void;
|
|
148
|
-
getCurrentAdIndex(): number;
|
|
149
|
-
getTotalAdsInBreak(): number;
|
|
150
306
|
}
|
|
151
307
|
|
|
152
308
|
type StormcloudVideoPlayerProps = Omit<StormcloudVideoPlayerConfig, "videoElement"> & React.VideoHTMLAttributes<HTMLVideoElement> & {
|
|
@@ -3774,26 +3930,46 @@ interface BrowserInfo {
|
|
|
3774
3930
|
isSmartTV: boolean;
|
|
3775
3931
|
isLegacyTV: boolean;
|
|
3776
3932
|
platform: string;
|
|
3933
|
+
supportsIMA: boolean;
|
|
3777
3934
|
supportsModernJS: boolean;
|
|
3935
|
+
recommendedAdPlayer: 'ima' | 'hls';
|
|
3936
|
+
webOSVersion?: number | undefined;
|
|
3937
|
+
tizenVersion?: number | undefined;
|
|
3938
|
+
chromeVersion?: number | undefined;
|
|
3778
3939
|
}
|
|
3779
3940
|
declare function detectBrowser(): BrowserInfo;
|
|
3941
|
+
declare function supportsGoogleIMA(): boolean;
|
|
3942
|
+
declare function getRecommendedAdPlayer(): 'ima' | 'hls';
|
|
3780
3943
|
declare function supportsModernJS(): boolean;
|
|
3781
3944
|
declare function logBrowserInfo(debug?: boolean): void;
|
|
3782
3945
|
declare function getBrowserConfigOverrides(): {
|
|
3946
|
+
adPlayerType?: 'ima' | 'hls';
|
|
3783
3947
|
allowNativeHls?: boolean;
|
|
3784
3948
|
};
|
|
3785
3949
|
declare function supportsFeature(feature: string): boolean;
|
|
3786
3950
|
|
|
3951
|
+
declare global {
|
|
3952
|
+
interface Window {
|
|
3953
|
+
google?: any;
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
declare function createImaController(video: HTMLVideoElement, options?: {
|
|
3957
|
+
continueLiveStreamDuringAds?: boolean;
|
|
3958
|
+
}): ImaController;
|
|
3959
|
+
|
|
3787
3960
|
declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
|
|
3788
3961
|
continueLiveStreamDuringAds?: boolean;
|
|
3789
3962
|
licenseKey?: string;
|
|
3790
3963
|
mainHlsInstance?: Hls;
|
|
3791
|
-
}):
|
|
3964
|
+
}): ImaController;
|
|
3792
3965
|
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3966
|
+
declare function createPrebidManager(config: PrebidConfig): PrebidManager;
|
|
3967
|
+
|
|
3968
|
+
interface PrebidControllerOptions {
|
|
3969
|
+
continueLiveStreamDuringAds?: boolean;
|
|
3970
|
+
licenseKey?: string;
|
|
3971
|
+
mainHlsInstance?: Hls;
|
|
3796
3972
|
}
|
|
3797
|
-
declare function
|
|
3973
|
+
declare function createPrebidController(contentVideo: HTMLVideoElement, prebidConfig: PrebidConfig, options?: PrebidControllerOptions): ImaController;
|
|
3798
3974
|
|
|
3799
|
-
export { type AdBreak, type
|
|
3975
|
+
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 PrebidConfig, type PrebidControllerOptions, type PrebidManager, type PrebidServerImp, type PrebidServerImpVideo, type PrebidServerRequest, 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 };
|
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface AdBreak {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
startTimeMs: number;
|
|
9
9
|
durationMs?: number;
|
|
10
|
+
vastTagUrl?: string;
|
|
10
11
|
}
|
|
11
12
|
interface AdSchedule {
|
|
12
13
|
breaks: AdBreak[];
|
|
@@ -31,12 +32,18 @@ interface StormcloudVideoPlayerConfig {
|
|
|
31
32
|
onFullscreenToggle?: () => void;
|
|
32
33
|
onControlClick?: () => void;
|
|
33
34
|
licenseKey?: string;
|
|
35
|
+
adPlayerType?: 'ima' | 'hls' | 'prebid';
|
|
36
|
+
vastTagUrl?: string;
|
|
37
|
+
vastMode?: 'adstorm' | 'default';
|
|
34
38
|
minSegmentsBeforePlay?: number;
|
|
39
|
+
prebid?: PrebidConfig;
|
|
35
40
|
}
|
|
36
|
-
interface
|
|
41
|
+
interface ImaController {
|
|
37
42
|
initialize: () => void;
|
|
38
|
-
requestAds: (
|
|
43
|
+
requestAds: (vastTagUrl: string) => Promise<void>;
|
|
39
44
|
play: () => Promise<void>;
|
|
45
|
+
pause: () => void;
|
|
46
|
+
resume: () => void;
|
|
40
47
|
stop: () => Promise<void>;
|
|
41
48
|
destroy: () => void;
|
|
42
49
|
isAdPlaying: () => boolean;
|
|
@@ -51,7 +58,7 @@ interface AdController {
|
|
|
51
58
|
showPlaceholder: () => void;
|
|
52
59
|
hidePlaceholder: () => void;
|
|
53
60
|
}
|
|
54
|
-
interface
|
|
61
|
+
interface ImaControllerOptions {
|
|
55
62
|
maxRetries?: number;
|
|
56
63
|
backoffBaseMs?: number;
|
|
57
64
|
}
|
|
@@ -95,58 +102,207 @@ interface HeartbeatData {
|
|
|
95
102
|
browserId: string;
|
|
96
103
|
timestamp: string;
|
|
97
104
|
}
|
|
105
|
+
interface PrebidServerImpVideo {
|
|
106
|
+
w?: number;
|
|
107
|
+
h?: number;
|
|
108
|
+
mimes?: string[];
|
|
109
|
+
placement?: number;
|
|
110
|
+
protocols?: number[];
|
|
111
|
+
minduration?: number;
|
|
112
|
+
maxduration?: number;
|
|
113
|
+
linearity?: number;
|
|
114
|
+
skip?: number;
|
|
115
|
+
playbackmethod?: number[];
|
|
116
|
+
api?: number[];
|
|
117
|
+
}
|
|
118
|
+
interface PrebidServerImp {
|
|
119
|
+
id: string;
|
|
120
|
+
instl?: number;
|
|
121
|
+
video?: PrebidServerImpVideo;
|
|
122
|
+
banner?: {
|
|
123
|
+
w?: number;
|
|
124
|
+
h?: number;
|
|
125
|
+
format?: Array<{
|
|
126
|
+
w: number;
|
|
127
|
+
h: number;
|
|
128
|
+
}>;
|
|
129
|
+
};
|
|
130
|
+
ext?: Record<string, any>;
|
|
131
|
+
}
|
|
132
|
+
interface PrebidServerRequest {
|
|
133
|
+
id: string;
|
|
134
|
+
site?: Record<string, any>;
|
|
135
|
+
device?: Record<string, any>;
|
|
136
|
+
imp: PrebidServerImp[];
|
|
137
|
+
tmax?: number;
|
|
138
|
+
ext?: Record<string, any>;
|
|
139
|
+
}
|
|
140
|
+
interface PrebidConfig {
|
|
141
|
+
enabled?: boolean;
|
|
142
|
+
serverUrl?: string;
|
|
143
|
+
ortbRequest: PrebidServerRequest;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
debug?: boolean;
|
|
146
|
+
cpmFloor?: number;
|
|
147
|
+
}
|
|
148
|
+
interface PrebidBidResponse {
|
|
149
|
+
bidder: string;
|
|
150
|
+
cpm: number;
|
|
151
|
+
vastUrl?: string;
|
|
152
|
+
vastXml?: string;
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
adId: string;
|
|
156
|
+
impId: string;
|
|
157
|
+
creativeId: string;
|
|
158
|
+
currency: string;
|
|
159
|
+
adomain?: string[];
|
|
160
|
+
}
|
|
161
|
+
interface PrebidManager {
|
|
162
|
+
initialize: () => Promise<void>;
|
|
163
|
+
requestBids: () => Promise<PrebidBidResponse[]>;
|
|
164
|
+
getVastUrl: () => Promise<string | null>;
|
|
165
|
+
destroy: () => void;
|
|
166
|
+
readonly isInitialized: boolean;
|
|
167
|
+
}
|
|
98
168
|
|
|
99
169
|
declare class StormcloudVideoPlayer {
|
|
100
170
|
private readonly video;
|
|
101
171
|
private readonly config;
|
|
102
172
|
private hls?;
|
|
103
|
-
private
|
|
173
|
+
private ima;
|
|
104
174
|
private attached;
|
|
105
175
|
private inAdBreak;
|
|
176
|
+
private currentAdBreakStartWallClockMs;
|
|
106
177
|
private expectedAdBreakDurationMs;
|
|
107
178
|
private adStopTimerId;
|
|
179
|
+
private adStartTimerId;
|
|
180
|
+
private adFailsafeTimerId;
|
|
108
181
|
private ptsDriftEmaMs;
|
|
182
|
+
private adPodQueue;
|
|
183
|
+
private apiVastTagUrl;
|
|
184
|
+
private apiNumberAds;
|
|
185
|
+
private lastHeartbeatTime;
|
|
186
|
+
private heartbeatInterval;
|
|
187
|
+
private currentAdIndex;
|
|
188
|
+
private totalAdsInBreak;
|
|
189
|
+
private showAds;
|
|
109
190
|
private isLiveStream;
|
|
110
191
|
private nativeHlsMode;
|
|
111
192
|
private videoSrcProtection;
|
|
112
193
|
private bufferedSegmentsCount;
|
|
113
194
|
private shouldAutoplayAfterBuffering;
|
|
114
195
|
private hasInitialBufferCompleted;
|
|
196
|
+
private adRequestTokenCounter;
|
|
197
|
+
private activeAdRequestToken;
|
|
198
|
+
private adRequestWatchdogId;
|
|
199
|
+
private adRequestWatchdogToken;
|
|
200
|
+
private adFailsafeToken;
|
|
201
|
+
private failedVastUrls;
|
|
202
|
+
private temporaryFailureUrls;
|
|
203
|
+
private readonly temporaryFailureCooldownMs;
|
|
204
|
+
private continuousFetchingActive;
|
|
205
|
+
private adRequestQueue;
|
|
206
|
+
private maxPlaceholderDurationMs;
|
|
207
|
+
private isShowingPlaceholder;
|
|
115
208
|
private timeUpdateHandler?;
|
|
116
209
|
private emptiedHandler?;
|
|
210
|
+
private totalAdRequestsInBreak;
|
|
211
|
+
private readonly maxTotalAdRequestsPerBreak;
|
|
212
|
+
private pendingAdBreak;
|
|
213
|
+
private prefetchTimerId;
|
|
214
|
+
private consecutiveFailures;
|
|
215
|
+
private readonly maxConsecutiveFailures;
|
|
216
|
+
private lastAdRequestTime;
|
|
217
|
+
private readonly minAdRequestIntervalMs;
|
|
218
|
+
private readonly backoffBaseMs;
|
|
219
|
+
private readonly maxBackoffMs;
|
|
220
|
+
private placeholderContainer;
|
|
221
|
+
private preloadPool;
|
|
222
|
+
private readonly maxPreloadPoolSize;
|
|
223
|
+
private preloadPoolActive;
|
|
224
|
+
private preloadPoolLoopRunning;
|
|
117
225
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
226
|
+
private createAdPlayer;
|
|
118
227
|
load(): Promise<void>;
|
|
228
|
+
private attachImaEventListeners;
|
|
229
|
+
private recreateImaController;
|
|
230
|
+
private ensurePlaceholderContainer;
|
|
231
|
+
private showPlaceholderLayer;
|
|
232
|
+
private hidePlaceholderLayer;
|
|
119
233
|
private attach;
|
|
120
234
|
private shouldUseNativeHls;
|
|
121
235
|
private onId3Tag;
|
|
122
236
|
private parseScte35FromId3;
|
|
123
237
|
private decodeId3ValueToText;
|
|
124
238
|
private onScte35Marker;
|
|
125
|
-
private handleAdStart;
|
|
126
239
|
private parseCueOutDuration;
|
|
127
240
|
private parseCueOutCont;
|
|
128
241
|
private parseAttributeList;
|
|
129
242
|
private toNumber;
|
|
130
|
-
private
|
|
131
|
-
private
|
|
132
|
-
private
|
|
133
|
-
private
|
|
243
|
+
private isManifestBasedMarker;
|
|
244
|
+
private parseScte35Binary;
|
|
245
|
+
private initializeTracking;
|
|
246
|
+
private sendHeartbeatIfNeeded;
|
|
247
|
+
private fetchAdConfiguration;
|
|
248
|
+
private isPrebidMode;
|
|
249
|
+
getCurrentAdIndex(): number;
|
|
250
|
+
getTotalAdsInBreak(): number;
|
|
251
|
+
private generateVastUrlsWithCorrelators;
|
|
134
252
|
isAdPlaying(): boolean;
|
|
135
253
|
isShowingAds(): boolean;
|
|
136
254
|
getStreamType(): "hls" | "other";
|
|
137
255
|
shouldShowNativeControls(): boolean;
|
|
256
|
+
private shouldContinueLiveStreamDuringAds;
|
|
257
|
+
private startAdPrefetch;
|
|
258
|
+
private clearPendingAdBreak;
|
|
259
|
+
private startPreloadPool;
|
|
260
|
+
private preloadAdIntoPool;
|
|
261
|
+
private preloadPoolLoop;
|
|
262
|
+
private getPreloadedAd;
|
|
263
|
+
private stopPreloadPool;
|
|
264
|
+
private handleAdStart;
|
|
265
|
+
private continuousFetchLoopRunning;
|
|
266
|
+
private startContinuousFetching;
|
|
267
|
+
private continuousFetchLoop;
|
|
268
|
+
private stopContinuousFetching;
|
|
269
|
+
private tryNextAvailableAdWithRateLimit;
|
|
270
|
+
private tryNextAvailableAd;
|
|
271
|
+
private showPlaceholderAndWaitForAds;
|
|
272
|
+
private findCurrentOrNextBreak;
|
|
273
|
+
private onTimeUpdate;
|
|
274
|
+
private handleMidAdJoin;
|
|
275
|
+
private scheduleAdStopCountdown;
|
|
276
|
+
private clearAdStopTimer;
|
|
277
|
+
private ensureAdStoppedByTimer;
|
|
278
|
+
private scheduleAdStartIn;
|
|
279
|
+
private clearAdStartTimer;
|
|
280
|
+
private updatePtsDrift;
|
|
281
|
+
private isTemporaryAdError;
|
|
282
|
+
private isUrlInCooldown;
|
|
283
|
+
private cleanupTemporaryFailures;
|
|
284
|
+
private playSingleAd;
|
|
285
|
+
private handleAdPodComplete;
|
|
286
|
+
private handleAdFailure;
|
|
287
|
+
private startAdRequestWatchdog;
|
|
288
|
+
private clearAdRequestWatchdog;
|
|
289
|
+
private startAdFailsafeTimer;
|
|
290
|
+
private clearAdFailsafeTimer;
|
|
291
|
+
private selectVastTagsForBreak;
|
|
292
|
+
private logAdState;
|
|
293
|
+
private getRemainingAdMs;
|
|
294
|
+
private findBreakForTime;
|
|
138
295
|
toggleMute(): void;
|
|
139
296
|
toggleFullscreen(): Promise<void>;
|
|
140
297
|
isMuted(): boolean;
|
|
141
298
|
setMuted(muted: boolean): void;
|
|
142
299
|
setVolume(volume: number): void;
|
|
300
|
+
getVolume(): number;
|
|
143
301
|
isFullscreen(): boolean;
|
|
144
302
|
isLive(): boolean;
|
|
145
303
|
get videoElement(): HTMLVideoElement;
|
|
146
304
|
resize(): void;
|
|
147
305
|
destroy(): void;
|
|
148
|
-
getCurrentAdIndex(): number;
|
|
149
|
-
getTotalAdsInBreak(): number;
|
|
150
306
|
}
|
|
151
307
|
|
|
152
308
|
type StormcloudVideoPlayerProps = Omit<StormcloudVideoPlayerConfig, "videoElement"> & React.VideoHTMLAttributes<HTMLVideoElement> & {
|
|
@@ -3774,26 +3930,46 @@ interface BrowserInfo {
|
|
|
3774
3930
|
isSmartTV: boolean;
|
|
3775
3931
|
isLegacyTV: boolean;
|
|
3776
3932
|
platform: string;
|
|
3933
|
+
supportsIMA: boolean;
|
|
3777
3934
|
supportsModernJS: boolean;
|
|
3935
|
+
recommendedAdPlayer: 'ima' | 'hls';
|
|
3936
|
+
webOSVersion?: number | undefined;
|
|
3937
|
+
tizenVersion?: number | undefined;
|
|
3938
|
+
chromeVersion?: number | undefined;
|
|
3778
3939
|
}
|
|
3779
3940
|
declare function detectBrowser(): BrowserInfo;
|
|
3941
|
+
declare function supportsGoogleIMA(): boolean;
|
|
3942
|
+
declare function getRecommendedAdPlayer(): 'ima' | 'hls';
|
|
3780
3943
|
declare function supportsModernJS(): boolean;
|
|
3781
3944
|
declare function logBrowserInfo(debug?: boolean): void;
|
|
3782
3945
|
declare function getBrowserConfigOverrides(): {
|
|
3946
|
+
adPlayerType?: 'ima' | 'hls';
|
|
3783
3947
|
allowNativeHls?: boolean;
|
|
3784
3948
|
};
|
|
3785
3949
|
declare function supportsFeature(feature: string): boolean;
|
|
3786
3950
|
|
|
3951
|
+
declare global {
|
|
3952
|
+
interface Window {
|
|
3953
|
+
google?: any;
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
declare function createImaController(video: HTMLVideoElement, options?: {
|
|
3957
|
+
continueLiveStreamDuringAds?: boolean;
|
|
3958
|
+
}): ImaController;
|
|
3959
|
+
|
|
3787
3960
|
declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
|
|
3788
3961
|
continueLiveStreamDuringAds?: boolean;
|
|
3789
3962
|
licenseKey?: string;
|
|
3790
3963
|
mainHlsInstance?: Hls;
|
|
3791
|
-
}):
|
|
3964
|
+
}): ImaController;
|
|
3792
3965
|
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3966
|
+
declare function createPrebidManager(config: PrebidConfig): PrebidManager;
|
|
3967
|
+
|
|
3968
|
+
interface PrebidControllerOptions {
|
|
3969
|
+
continueLiveStreamDuringAds?: boolean;
|
|
3970
|
+
licenseKey?: string;
|
|
3971
|
+
mainHlsInstance?: Hls;
|
|
3796
3972
|
}
|
|
3797
|
-
declare function
|
|
3973
|
+
declare function createPrebidController(contentVideo: HTMLVideoElement, prebidConfig: PrebidConfig, options?: PrebidControllerOptions): ImaController;
|
|
3798
3974
|
|
|
3799
|
-
export { type AdBreak, type
|
|
3975
|
+
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 PrebidConfig, type PrebidControllerOptions, type PrebidManager, type PrebidServerImp, type PrebidServerImpVideo, type PrebidServerRequest, 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 };
|