stormcloud-video-player 0.5.2 → 0.5.3
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 +23 -118
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +7 -47
- package/lib/index.d.ts +7 -47
- package/lib/index.js +23 -118
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +20 -111
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +20 -111
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +20 -111
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/sdk/ima.d.cts +1 -1
- package/lib/sdk/prebid.cjs +11 -77
- package/lib/sdk/prebid.cjs.map +1 -1
- package/lib/sdk/prebid.d.cts +6 -3
- package/lib/sdk/prebidController.cjs +16 -99
- package/lib/sdk/prebidController.cjs.map +1 -1
- package/lib/sdk/prebidController.d.cts +3 -2
- package/lib/sdk/vastParser.cjs.map +1 -1
- package/lib/{types-g2d4Akez.d.cts → types-CRi_KrjM.d.cts} +1 -45
- package/lib/ui/StormcloudVideoPlayer.cjs +23 -118
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -36,7 +36,6 @@ interface StormcloudVideoPlayerConfig {
|
|
|
36
36
|
vastTagUrl?: string;
|
|
37
37
|
vastMode?: 'adstorm' | 'default';
|
|
38
38
|
minSegmentsBeforePlay?: number;
|
|
39
|
-
prebid?: PrebidConfig;
|
|
40
39
|
}
|
|
41
40
|
interface ImaController {
|
|
42
41
|
initialize: () => void;
|
|
@@ -102,49 +101,6 @@ interface HeartbeatData {
|
|
|
102
101
|
browserId: string;
|
|
103
102
|
timestamp: string;
|
|
104
103
|
}
|
|
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
104
|
interface PrebidBidResponse {
|
|
149
105
|
bidder: string;
|
|
150
106
|
cpm: number;
|
|
@@ -3963,13 +3919,17 @@ declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
|
|
|
3963
3919
|
mainHlsInstance?: Hls;
|
|
3964
3920
|
}): ImaController;
|
|
3965
3921
|
|
|
3966
|
-
|
|
3922
|
+
interface PrebidManagerOptions {
|
|
3923
|
+
debug?: boolean;
|
|
3924
|
+
}
|
|
3925
|
+
declare function createPrebidManager(options?: PrebidManagerOptions): PrebidManager;
|
|
3967
3926
|
|
|
3968
3927
|
interface PrebidControllerOptions {
|
|
3969
3928
|
continueLiveStreamDuringAds?: boolean;
|
|
3970
3929
|
licenseKey?: string;
|
|
3971
3930
|
mainHlsInstance?: Hls;
|
|
3931
|
+
debug?: boolean;
|
|
3972
3932
|
}
|
|
3973
|
-
declare function createPrebidController(contentVideo: HTMLVideoElement,
|
|
3933
|
+
declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): ImaController;
|
|
3974
3934
|
|
|
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
|
|
3935
|
+
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 };
|
package/lib/index.d.ts
CHANGED
|
@@ -36,7 +36,6 @@ interface StormcloudVideoPlayerConfig {
|
|
|
36
36
|
vastTagUrl?: string;
|
|
37
37
|
vastMode?: 'adstorm' | 'default';
|
|
38
38
|
minSegmentsBeforePlay?: number;
|
|
39
|
-
prebid?: PrebidConfig;
|
|
40
39
|
}
|
|
41
40
|
interface ImaController {
|
|
42
41
|
initialize: () => void;
|
|
@@ -102,49 +101,6 @@ interface HeartbeatData {
|
|
|
102
101
|
browserId: string;
|
|
103
102
|
timestamp: string;
|
|
104
103
|
}
|
|
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
104
|
interface PrebidBidResponse {
|
|
149
105
|
bidder: string;
|
|
150
106
|
cpm: number;
|
|
@@ -3963,13 +3919,17 @@ declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
|
|
|
3963
3919
|
mainHlsInstance?: Hls;
|
|
3964
3920
|
}): ImaController;
|
|
3965
3921
|
|
|
3966
|
-
|
|
3922
|
+
interface PrebidManagerOptions {
|
|
3923
|
+
debug?: boolean;
|
|
3924
|
+
}
|
|
3925
|
+
declare function createPrebidManager(options?: PrebidManagerOptions): PrebidManager;
|
|
3967
3926
|
|
|
3968
3927
|
interface PrebidControllerOptions {
|
|
3969
3928
|
continueLiveStreamDuringAds?: boolean;
|
|
3970
3929
|
licenseKey?: string;
|
|
3971
3930
|
mainHlsInstance?: Hls;
|
|
3931
|
+
debug?: boolean;
|
|
3972
3932
|
}
|
|
3973
|
-
declare function createPrebidController(contentVideo: HTMLVideoElement,
|
|
3933
|
+
declare function createPrebidController(contentVideo: HTMLVideoElement, options?: PrebidControllerOptions): ImaController;
|
|
3974
3934
|
|
|
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
|
|
3935
|
+
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 };
|
package/lib/index.js
CHANGED
|
@@ -2465,12 +2465,12 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2465
2465
|
}
|
|
2466
2466
|
// src/sdk/prebid.ts
|
|
2467
2467
|
var DEFAULT_TIMEOUT_MS = 3e3;
|
|
2468
|
-
var
|
|
2469
|
-
function createPrebidManager(
|
|
2468
|
+
var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
|
|
2469
|
+
function createPrebidManager() {
|
|
2470
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2470
2471
|
var initialized = false;
|
|
2471
|
-
var
|
|
2472
|
-
var
|
|
2473
|
-
var debug = (_config_debug = config.debug) !== null && _config_debug !== void 0 ? _config_debug : false;
|
|
2472
|
+
var _options_debug;
|
|
2473
|
+
var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
|
|
2474
2474
|
function log() {
|
|
2475
2475
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
2476
2476
|
args[_key] = arguments[_key];
|
|
@@ -2491,49 +2491,6 @@ function createPrebidManager(config) {
|
|
|
2491
2491
|
"[Prebid]"
|
|
2492
2492
|
].concat(_to_consumable_array(args)));
|
|
2493
2493
|
}
|
|
2494
|
-
function resolveServerUrl() {
|
|
2495
|
-
var _config_ortbRequest_ext_prebid_server, _config_ortbRequest_ext_prebid, _config_ortbRequest_ext, _config_ortbRequest;
|
|
2496
|
-
if (config.serverUrl) {
|
|
2497
|
-
return config.serverUrl.replace(/\/$/, "");
|
|
2498
|
-
}
|
|
2499
|
-
var extUrl = (_config_ortbRequest = config.ortbRequest) === null || _config_ortbRequest === void 0 ? void 0 : (_config_ortbRequest_ext = _config_ortbRequest.ext) === null || _config_ortbRequest_ext === void 0 ? void 0 : (_config_ortbRequest_ext_prebid = _config_ortbRequest_ext.prebid) === null || _config_ortbRequest_ext_prebid === void 0 ? void 0 : (_config_ortbRequest_ext_prebid_server = _config_ortbRequest_ext_prebid.server) === null || _config_ortbRequest_ext_prebid_server === void 0 ? void 0 : _config_ortbRequest_ext_prebid_server.externalurl;
|
|
2500
|
-
if (typeof extUrl === "string" && extUrl.length > 0) {
|
|
2501
|
-
return extUrl.replace(/\/$/, "");
|
|
2502
|
-
}
|
|
2503
|
-
throw new Error("Prebid Server URL not configured. Provide serverUrl in PrebidConfig or ext.prebid.server.externalurl in the OpenRTB request.");
|
|
2504
|
-
}
|
|
2505
|
-
function buildRequest() {
|
|
2506
|
-
var req = JSON.parse(JSON.stringify(config.ortbRequest));
|
|
2507
|
-
req.id = "".concat(req.id || "prebid", "-").concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 8));
|
|
2508
|
-
if (!req.ext) req.ext = {};
|
|
2509
|
-
if (!req.ext.prebid) req.ext.prebid = {};
|
|
2510
|
-
if (!req.ext.prebid.cache) req.ext.prebid.cache = {};
|
|
2511
|
-
if (!req.ext.prebid.cache.vastxml) req.ext.prebid.cache.vastxml = {};
|
|
2512
|
-
if (!req.ext.prebid.targeting) {
|
|
2513
|
-
req.ext.prebid.targeting = {
|
|
2514
|
-
includewinners: true,
|
|
2515
|
-
includebidderkeys: false
|
|
2516
|
-
};
|
|
2517
|
-
}
|
|
2518
|
-
if (!req.device) req.device = {};
|
|
2519
|
-
if (typeof navigator !== "undefined") {
|
|
2520
|
-
if (!req.device.ua) req.device.ua = navigator.userAgent;
|
|
2521
|
-
if (!req.device.language) {
|
|
2522
|
-
req.device.language = (navigator.language || "").split("-")[0] || "en";
|
|
2523
|
-
}
|
|
2524
|
-
}
|
|
2525
|
-
if (typeof window !== "undefined") {
|
|
2526
|
-
var _window_screen, _window_screen1;
|
|
2527
|
-
if (!req.device.w) req.device.w = ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.width) || window.innerWidth;
|
|
2528
|
-
if (!req.device.h) req.device.h = ((_window_screen1 = window.screen) === null || _window_screen1 === void 0 ? void 0 : _window_screen1.height) || window.innerHeight;
|
|
2529
|
-
}
|
|
2530
|
-
if (!req.site) req.site = {};
|
|
2531
|
-
if (typeof window !== "undefined") {
|
|
2532
|
-
if (!req.site.page) req.site.page = window.location.href;
|
|
2533
|
-
if (!req.site.domain) req.site.domain = window.location.hostname;
|
|
2534
|
-
}
|
|
2535
|
-
return req;
|
|
2536
|
-
}
|
|
2537
2494
|
function parseResponse(data) {
|
|
2538
2495
|
var bids = [];
|
|
2539
2496
|
var seatbids = (data === null || data === void 0 ? void 0 : data.seatbid) || [];
|
|
@@ -2603,12 +2560,6 @@ function createPrebidManager(config) {
|
|
|
2603
2560
|
function extractVastUrl(bids) {
|
|
2604
2561
|
if (bids.length === 0) return null;
|
|
2605
2562
|
var winner = bids[0];
|
|
2606
|
-
var _config_cpmFloor;
|
|
2607
|
-
var cpmFloor = (_config_cpmFloor = config.cpmFloor) !== null && _config_cpmFloor !== void 0 ? _config_cpmFloor : 0;
|
|
2608
|
-
if (cpmFloor > 0 && winner.cpm < cpmFloor) {
|
|
2609
|
-
log("Winning bid $".concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
|
|
2610
|
-
return null;
|
|
2611
|
-
}
|
|
2612
2563
|
if (winner.vastUrl) {
|
|
2613
2564
|
log("Using cached VAST URL from ".concat(winner.bidder, " ($").concat(winner.cpm.toFixed(2), " ").concat(winner.currency, ")"));
|
|
2614
2565
|
return winner.vastUrl;
|
|
@@ -2630,22 +2581,12 @@ function createPrebidManager(config) {
|
|
|
2630
2581
|
}
|
|
2631
2582
|
function initialize() {
|
|
2632
2583
|
return _async_to_generator(function() {
|
|
2633
|
-
var _config_ortbRequest;
|
|
2634
2584
|
return _ts_generator(this, function(_state) {
|
|
2635
2585
|
if (initialized) return [
|
|
2636
2586
|
2
|
|
2637
2587
|
];
|
|
2638
|
-
serverUrl = resolveServerUrl();
|
|
2639
|
-
if (!((_config_ortbRequest = config.ortbRequest) === null || _config_ortbRequest === void 0 ? void 0 : _config_ortbRequest.imp) || config.ortbRequest.imp.length === 0) {
|
|
2640
|
-
throw new Error("No impressions (imp) defined in the OpenRTB request.");
|
|
2641
|
-
}
|
|
2642
2588
|
initialized = true;
|
|
2643
|
-
log("Initialized
|
|
2644
|
-
log("Bidders:", config.ortbRequest.imp.map(function(imp) {
|
|
2645
|
-
var _imp_ext_prebid, _imp_ext;
|
|
2646
|
-
var bidders = (_imp_ext = imp.ext) === null || _imp_ext === void 0 ? void 0 : (_imp_ext_prebid = _imp_ext.prebid) === null || _imp_ext_prebid === void 0 ? void 0 : _imp_ext_prebid.bidder;
|
|
2647
|
-
return bidders ? Object.keys(bidders).join(", ") : "none";
|
|
2648
|
-
}).join("; "));
|
|
2589
|
+
log("Initialized, auction URL:", AUCTION_URL);
|
|
2649
2590
|
return [
|
|
2650
2591
|
2
|
|
2651
2592
|
];
|
|
@@ -2654,17 +2595,15 @@ function createPrebidManager(config) {
|
|
|
2654
2595
|
}
|
|
2655
2596
|
function requestBids() {
|
|
2656
2597
|
return _async_to_generator(function() {
|
|
2657
|
-
var
|
|
2598
|
+
var timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, response, body, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
|
|
2658
2599
|
return _ts_generator(this, function(_state) {
|
|
2659
2600
|
switch(_state.label){
|
|
2660
2601
|
case 0:
|
|
2661
2602
|
if (!initialized) {
|
|
2662
2603
|
throw new Error("Prebid not initialized. Call initialize() first.");
|
|
2663
2604
|
}
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
timeout = (_ref = (_config_timeout = config.timeout) !== null && _config_timeout !== void 0 ? _config_timeout : config.ortbRequest.tmax) !== null && _ref !== void 0 ? _ref : DEFAULT_TIMEOUT_MS;
|
|
2667
|
-
log("Sending auction request to:", auctionUrl);
|
|
2605
|
+
timeout = DEFAULT_TIMEOUT_MS;
|
|
2606
|
+
log("Fetching auction response from:", AUCTION_URL);
|
|
2668
2607
|
controller = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
2669
2608
|
timeoutId = setTimeout(function() {
|
|
2670
2609
|
controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
@@ -2678,18 +2617,14 @@ function createPrebidManager(config) {
|
|
|
2678
2617
|
7
|
|
2679
2618
|
]);
|
|
2680
2619
|
fetchOptions = {
|
|
2681
|
-
method: "POST"
|
|
2682
|
-
headers: {
|
|
2683
|
-
"Content-Type": "application/json"
|
|
2684
|
-
},
|
|
2685
|
-
body: JSON.stringify(request)
|
|
2620
|
+
method: "POST"
|
|
2686
2621
|
};
|
|
2687
2622
|
if (controller) {
|
|
2688
2623
|
fetchOptions.signal = controller.signal;
|
|
2689
2624
|
}
|
|
2690
2625
|
return [
|
|
2691
2626
|
4,
|
|
2692
|
-
fetch(
|
|
2627
|
+
fetch(AUCTION_URL, fetchOptions)
|
|
2693
2628
|
];
|
|
2694
2629
|
case 2:
|
|
2695
2630
|
response = _state.sent();
|
|
@@ -2806,7 +2741,6 @@ function createPrebidManager(config) {
|
|
|
2806
2741
|
}
|
|
2807
2742
|
function destroy() {
|
|
2808
2743
|
initialized = false;
|
|
2809
|
-
serverUrl = "";
|
|
2810
2744
|
log("Destroyed");
|
|
2811
2745
|
}
|
|
2812
2746
|
return {
|
|
@@ -2822,7 +2756,7 @@ function createPrebidManager(config) {
|
|
|
2822
2756
|
// src/sdk/prebidController.ts
|
|
2823
2757
|
import Hls2 from "hls.js";
|
|
2824
2758
|
var LOG = "[PrebidController]";
|
|
2825
|
-
function createPrebidController(contentVideo,
|
|
2759
|
+
function createPrebidController(contentVideo, options) {
|
|
2826
2760
|
var adPlaying = false;
|
|
2827
2761
|
var originalMutedState = false;
|
|
2828
2762
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -2836,11 +2770,9 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
2836
2770
|
var sessionId;
|
|
2837
2771
|
var destroyed = false;
|
|
2838
2772
|
var trackingFired = createEmptyTrackingState();
|
|
2839
|
-
var
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
debug: prebidDebug
|
|
2843
|
-
}));
|
|
2773
|
+
var prebidManager = createPrebidManager((options === null || options === void 0 ? void 0 : options.debug) !== void 0 ? {
|
|
2774
|
+
debug: options.debug
|
|
2775
|
+
} : {});
|
|
2844
2776
|
var prebidInitialized = false;
|
|
2845
2777
|
function emit(event, payload) {
|
|
2846
2778
|
var set = listeners.get(event);
|
|
@@ -3063,19 +2995,12 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
3063
2995
|
}
|
|
3064
2996
|
function ensurePrebidInitialized() {
|
|
3065
2997
|
return _async_to_generator(function() {
|
|
3066
|
-
var _prebidConfig_ortbRequest_imp, _prebidConfig_ortbRequest;
|
|
3067
2998
|
return _ts_generator(this, function(_state) {
|
|
3068
2999
|
switch(_state.label){
|
|
3069
3000
|
case 0:
|
|
3070
3001
|
if (prebidInitialized) return [
|
|
3071
3002
|
2
|
|
3072
3003
|
];
|
|
3073
|
-
if (prebidConfig.enabled === false) {
|
|
3074
|
-
throw new Error("Prebid is disabled in config");
|
|
3075
|
-
}
|
|
3076
|
-
if (!((_prebidConfig_ortbRequest = prebidConfig.ortbRequest) === null || _prebidConfig_ortbRequest === void 0 ? void 0 : (_prebidConfig_ortbRequest_imp = _prebidConfig_ortbRequest.imp) === null || _prebidConfig_ortbRequest_imp === void 0 ? void 0 : _prebidConfig_ortbRequest_imp.length)) {
|
|
3077
|
-
throw new Error("No impressions configured in ortbRequest");
|
|
3078
|
-
}
|
|
3079
3004
|
return [
|
|
3080
3005
|
4,
|
|
3081
3006
|
prebidManager.initialize()
|
|
@@ -3093,7 +3018,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
3093
3018
|
}
|
|
3094
3019
|
function runPrebidAuction() {
|
|
3095
3020
|
return _async_to_generator(function() {
|
|
3096
|
-
var bids,
|
|
3021
|
+
var bids, winner;
|
|
3097
3022
|
return _ts_generator(this, function(_state) {
|
|
3098
3023
|
switch(_state.label){
|
|
3099
3024
|
case 0:
|
|
@@ -3116,15 +3041,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
3116
3041
|
null
|
|
3117
3042
|
];
|
|
3118
3043
|
}
|
|
3119
|
-
cpmFloor = (_prebidConfig_cpmFloor = prebidConfig.cpmFloor) !== null && _prebidConfig_cpmFloor !== void 0 ? _prebidConfig_cpmFloor : 0;
|
|
3120
3044
|
winner = bids[0];
|
|
3121
|
-
if (cpmFloor > 0 && winner.cpm < cpmFloor) {
|
|
3122
|
-
console.log("".concat(LOG, " Winning bid $").concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
|
|
3123
|
-
return [
|
|
3124
|
-
2,
|
|
3125
|
-
null
|
|
3126
|
-
];
|
|
3127
|
-
}
|
|
3128
3045
|
console.log("".concat(LOG, " Winning bid: ").concat(winner.bidder, " $").concat(winner.cpm.toFixed(2), " ").concat(winner.currency));
|
|
3129
3046
|
if (winner.vastXml) {
|
|
3130
3047
|
console.log("".concat(LOG, " Parsing VAST XML from bid response (inline)"));
|
|
@@ -4232,22 +4149,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4232
4149
|
adPlayerType = "hls";
|
|
4233
4150
|
}
|
|
4234
4151
|
if (adPlayerType === "prebid") {
|
|
4235
|
-
if (!this.config.prebid) {
|
|
4236
|
-
console.warn("[StormcloudVideoPlayer] adPlayerType is 'prebid' but no prebid config provided, falling back to HLS ad player");
|
|
4237
|
-
return createHlsAdPlayer(this.video, _object_spread({
|
|
4238
|
-
continueLiveStreamDuringAds: continueLiveStreamDuringAds
|
|
4239
|
-
}, this.config.licenseKey ? {
|
|
4240
|
-
licenseKey: this.config.licenseKey
|
|
4241
|
-
} : {}, this.hls ? {
|
|
4242
|
-
mainHlsInstance: this.hls
|
|
4243
|
-
} : {}));
|
|
4244
|
-
}
|
|
4245
4152
|
if (this.config.debugAdTiming) {
|
|
4246
4153
|
console.log("[StormcloudVideoPlayer] Creating Prebid ad controller (standalone, no IMA SDK)");
|
|
4247
4154
|
}
|
|
4248
|
-
return createPrebidController(this.video,
|
|
4155
|
+
return createPrebidController(this.video, _object_spread({
|
|
4249
4156
|
continueLiveStreamDuringAds: continueLiveStreamDuringAds
|
|
4250
|
-
}, this.config.
|
|
4157
|
+
}, this.config.debugAdTiming !== void 0 ? {
|
|
4158
|
+
debug: this.config.debugAdTiming
|
|
4159
|
+
} : {}, this.config.licenseKey ? {
|
|
4251
4160
|
licenseKey: this.config.licenseKey
|
|
4252
4161
|
} : {}, this.hls ? {
|
|
4253
4162
|
mainHlsInstance: this.hls
|
|
@@ -7944,11 +7853,10 @@ var CRITICAL_PROPS = [
|
|
|
7944
7853
|
"lowLatencyMode",
|
|
7945
7854
|
"driftToleranceMs",
|
|
7946
7855
|
"vastMode",
|
|
7947
|
-
"adPlayerType"
|
|
7948
|
-
"prebid"
|
|
7856
|
+
"adPlayerType"
|
|
7949
7857
|
];
|
|
7950
7858
|
var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
7951
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, adPlayerType = props.adPlayerType,
|
|
7859
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, adPlayerType = props.adPlayerType, minSegmentsBeforePlay = props.minSegmentsBeforePlay, restVideoAttrs = _object_without_properties(props, [
|
|
7952
7860
|
"src",
|
|
7953
7861
|
"autoplay",
|
|
7954
7862
|
"muted",
|
|
@@ -7976,7 +7884,6 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7976
7884
|
"vastMode",
|
|
7977
7885
|
"vastTagUrl",
|
|
7978
7886
|
"adPlayerType",
|
|
7979
|
-
"prebid",
|
|
7980
7887
|
"minSegmentsBeforePlay"
|
|
7981
7888
|
]);
|
|
7982
7889
|
var videoRef = useRef(null);
|
|
@@ -8086,8 +7993,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8086
7993
|
lowLatencyMode,
|
|
8087
7994
|
driftToleranceMs,
|
|
8088
7995
|
vastMode,
|
|
8089
|
-
adPlayerType
|
|
8090
|
-
prebid
|
|
7996
|
+
adPlayerType
|
|
8091
7997
|
]);
|
|
8092
7998
|
useEffect(function() {
|
|
8093
7999
|
if (typeof window === "undefined") return;
|
|
@@ -8128,7 +8034,6 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8128
8034
|
if (vastMode !== void 0) cfg.vastMode = vastMode;
|
|
8129
8035
|
if (vastTagUrl !== void 0) cfg.vastTagUrl = vastTagUrl;
|
|
8130
8036
|
if (adPlayerType !== void 0) cfg.adPlayerType = adPlayerType;
|
|
8131
|
-
if (prebid !== void 0) cfg.prebid = prebid;
|
|
8132
8037
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
8133
8038
|
var player = new StormcloudVideoPlayer(cfg);
|
|
8134
8039
|
playerRef.current = player;
|