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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/ubuntu24/Dev/stormcloud-vp/lib/players/FilePlayer.cjs"],"names":[],"mappings":"AAAA","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/players/FilePlayer.tsx\nvar FilePlayer_exports = {};\n__export(FilePlayer_exports, {\n default: () => FilePlayer\n});\nmodule.exports = __toCommonJS(FilePlayer_exports);\nvar import_react = require(\"react\");\n\n// src/patterns.ts\nvar HLS_EXTENSIONS = /\\.(m3u8)($|\\?)/i;\nvar HLS_PATHS = /\\/hls\\//i;\nvar DASH_EXTENSIONS = /\\.(mpd)($|\\?)/i;\nvar VIDEO_EXTENSIONS = /\\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\\?)/i;\nvar AUDIO_EXTENSIONS = /\\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\\?)/i;\nvar canPlay = {\n hls: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);\n },\n dash: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return DASH_EXTENSIONS.test(url);\n },\n video: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return VIDEO_EXTENSIONS.test(url);\n },\n audio: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return AUDIO_EXTENSIONS.test(url);\n },\n file: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);\n }\n};\n\n// src/players/FilePlayer.tsx\nvar FilePlayer = class extends import_react.Component {\n constructor() {\n super(...arguments);\n this.mounted = false;\n this.ready = false;\n this.load = () => {\n if (!this.props.videoElement || !this.props.src) return;\n const video = this.props.videoElement;\n const handleLoadedMetadata = () => {\n if (this.mounted && !this.ready) {\n this.ready = true;\n this.props.onReady?.();\n }\n };\n const handlePlay = () => {\n if (this.mounted) {\n this.props.onPlay?.();\n }\n };\n const handlePause = () => {\n if (this.mounted) {\n this.props.onPause?.();\n }\n };\n const handleEnded = () => {\n if (this.mounted) {\n this.props.onEnded?.();\n }\n };\n const handleError = (error) => {\n if (this.mounted) {\n this.props.onError?.(error);\n }\n };\n const handleLoadedData = () => {\n if (this.mounted) {\n this.props.onLoaded?.();\n }\n };\n video.addEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.addEventListener(\"play\", handlePlay);\n video.addEventListener(\"pause\", handlePause);\n video.addEventListener(\"ended\", handleEnded);\n video.addEventListener(\"error\", handleError);\n video.addEventListener(\"loadeddata\", handleLoadedData);\n video.src = this.props.src;\n if (this.props.autoplay !== void 0) video.autoplay = this.props.autoplay;\n if (this.props.muted !== void 0) video.muted = this.props.muted;\n if (this.props.loop !== void 0) video.loop = this.props.loop;\n if (this.props.controls !== void 0) video.controls = this.props.controls;\n if (this.props.playsInline !== void 0)\n video.playsInline = this.props.playsInline;\n if (this.props.preload !== void 0)\n video.preload = this.props.preload;\n if (this.props.poster !== void 0) video.poster = this.props.poster;\n this.props.onMount?.(this);\n return () => {\n video.removeEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.removeEventListener(\"play\", handlePlay);\n video.removeEventListener(\"pause\", handlePause);\n video.removeEventListener(\"ended\", handleEnded);\n video.removeEventListener(\"error\", handleError);\n video.removeEventListener(\"loadeddata\", handleLoadedData);\n };\n };\n this.play = () => {\n if (this.props.videoElement) {\n const video = this.props.videoElement;\n const hasValidSource = video.src || video.currentSrc && video.currentSrc !== \"\" || video.readyState >= 1;\n if (hasValidSource) {\n video.play()?.catch((error) => {\n console.error(\"[FilePlayer] Failed to play:\", error);\n this.props.onError?.(error);\n });\n } else {\n console.warn(\"[FilePlayer] Cannot play: video has no valid source\");\n }\n }\n };\n this.pause = () => {\n if (this.props.videoElement) {\n this.props.videoElement.pause();\n }\n };\n this.stop = () => {\n this.pause();\n if (this.props.videoElement) {\n this.props.videoElement.currentTime = 0;\n }\n };\n this.seekTo = (seconds, keepPlaying) => {\n if (this.props.videoElement) {\n this.props.videoElement.currentTime = seconds;\n if (!keepPlaying) {\n this.pause();\n }\n }\n };\n this.setVolume = (volume) => {\n if (this.props.videoElement) {\n this.props.videoElement.volume = Math.max(0, Math.min(1, volume));\n }\n };\n this.mute = () => {\n if (this.props.videoElement) {\n this.props.videoElement.muted = true;\n }\n };\n this.unmute = () => {\n if (this.props.videoElement) {\n this.props.videoElement.muted = false;\n }\n };\n this.setPlaybackRate = (rate) => {\n if (this.props.videoElement && rate > 0) {\n this.props.videoElement.playbackRate = rate;\n }\n };\n this.setLoop = (loop) => {\n if (this.props.videoElement) {\n this.props.videoElement.loop = loop;\n }\n };\n this.getDuration = () => {\n if (this.props.videoElement && isFinite(this.props.videoElement.duration)) {\n return this.props.videoElement.duration;\n }\n return null;\n };\n this.getCurrentTime = () => {\n if (this.props.videoElement && isFinite(this.props.videoElement.currentTime)) {\n return this.props.videoElement.currentTime;\n }\n return null;\n };\n this.getSecondsLoaded = () => {\n if (this.props.videoElement && this.props.videoElement.buffered.length > 0) {\n return this.props.videoElement.buffered.end(\n this.props.videoElement.buffered.length - 1\n );\n }\n return null;\n };\n this.getInternalPlayer = (key = \"player\") => {\n if (key === \"video\") return this.props.videoElement;\n return null;\n };\n this.enablePIP = async () => {\n if (this.props.videoElement && \"requestPictureInPicture\" in this.props.videoElement) {\n try {\n await this.props.videoElement.requestPictureInPicture();\n } catch (error) {\n console.warn(\"Picture-in-Picture failed:\", error);\n }\n }\n };\n this.disablePIP = async () => {\n if (document.pictureInPictureElement) {\n try {\n await document.exitPictureInPicture();\n } catch (error) {\n console.warn(\"Exit Picture-in-Picture failed:\", error);\n }\n }\n };\n }\n componentDidMount() {\n this.mounted = true;\n this.load();\n }\n componentWillUnmount() {\n this.mounted = false;\n }\n componentDidUpdate(prevProps) {\n if (prevProps.src !== this.props.src) {\n this.load();\n }\n }\n render() {\n return null;\n }\n};\nFilePlayer.displayName = \"FilePlayer\";\nFilePlayer.canPlay = canPlay.file;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/ubuntu24/Dev/stormcloud-vp/lib/players/FilePlayer.cjs"],"names":["__getOwnPropNames","Object","getOwnPropertyNames","__export","target","all","name","__defProp","get","enumerable","__copyProps","to","from","except","desc","key","__hasOwnProp","call","__getOwnPropDesc"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAGIA,oBAAoBC,OAAOC,mBAAmB;;;;;;YAElD,KAAA;mBAAA,SAAA,EAAIC,WAAW,SAACC,QAAQC;gBACtB,IAAK,CAAA,GAAIC,IAAAA,GAAAA,CAAQD,IACfE,UAAUH,QAAQE,MAAM;oBAAEE,CAAAA,IAAKH,GAAG,CAACC,KAAK;kBAAEG,YAAY;;;;8BAAK;gBAC/D,IAAA,CAAA,OAAA,GAAA;YACA,EAAIC,cAAc,SAACC,IAAIC,MAAMC,QAAQC;;;cACnC,IAAIF,QAAQ,CAAA;+CAAA,GAAOA,MAAAA,+BAAP,SAAOA,KAAG,MAAM,YAAY,OAAOA,SAAS,YAAY;wBAC7D,MAAA,GAAA,KAAA,IAAA,CAAA,KAAA,CAAA,GAAA,EAAA,IAAA,2BAAA;;;0BAAA,IAAIG,MAAJ;;;0BACH,IAAI,CAACC,aAAaC,IAAI,CAACN,IAAII,QAAQA,QAAQF,QACzCN,UAAUI,IAAII,KAAK;;gCAAEP,KAAK;yCAAMI,IAAI,CAACG,IAAI;;;;;oBAAEN,EAAAA,GAAAA,OAAY,CAAEK,CAAAA,OAAOI,iBAAiBN,MAAMG,IAAG,KAAMD,KAAKL,UAAU;gBAAC,EAAA,GAAA,QAAA,IAAA","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/players/FilePlayer.tsx\nvar FilePlayer_exports = {};\n__export(FilePlayer_exports, {\n default: () => FilePlayer\n});\nmodule.exports = __toCommonJS(FilePlayer_exports);\nvar import_react = require(\"react\");\n\n// src/patterns.ts\nvar HLS_EXTENSIONS = /\\.(m3u8)($|\\?)/i;\nvar HLS_PATHS = /\\/hls\\//i;\nvar DASH_EXTENSIONS = /\\.(mpd)($|\\?)/i;\nvar VIDEO_EXTENSIONS = /\\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\\?)/i;\nvar AUDIO_EXTENSIONS = /\\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\\?)/i;\nvar canPlay = {\n hls: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);\n },\n dash: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return DASH_EXTENSIONS.test(url);\n },\n video: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return VIDEO_EXTENSIONS.test(url);\n },\n audio: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return AUDIO_EXTENSIONS.test(url);\n },\n file: (url) => {\n if (!url || typeof url !== \"string\") return false;\n return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);\n }\n};\n\n// src/players/FilePlayer.tsx\nvar FilePlayer = class extends import_react.Component {\n constructor() {\n super(...arguments);\n this.mounted = false;\n this.ready = false;\n this.load = () => {\n if (!this.props.videoElement || !this.props.src) return;\n const video = this.props.videoElement;\n const handleLoadedMetadata = () => {\n if (this.mounted && !this.ready) {\n this.ready = true;\n this.props.onReady?.();\n }\n };\n const handlePlay = () => {\n if (this.mounted) {\n this.props.onPlay?.();\n }\n };\n const handlePause = () => {\n if (this.mounted) {\n this.props.onPause?.();\n }\n };\n const handleEnded = () => {\n if (this.mounted) {\n this.props.onEnded?.();\n }\n };\n const handleError = (error) => {\n if (this.mounted) {\n this.props.onError?.(error);\n }\n };\n const handleLoadedData = () => {\n if (this.mounted) {\n this.props.onLoaded?.();\n }\n };\n video.addEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.addEventListener(\"play\", handlePlay);\n video.addEventListener(\"pause\", handlePause);\n video.addEventListener(\"ended\", handleEnded);\n video.addEventListener(\"error\", handleError);\n video.addEventListener(\"loadeddata\", handleLoadedData);\n video.src = this.props.src;\n if (this.props.autoplay !== void 0) video.autoplay = this.props.autoplay;\n if (this.props.muted !== void 0) video.muted = this.props.muted;\n if (this.props.loop !== void 0) video.loop = this.props.loop;\n if (this.props.controls !== void 0) video.controls = this.props.controls;\n if (this.props.playsInline !== void 0)\n video.playsInline = this.props.playsInline;\n if (this.props.preload !== void 0)\n video.preload = this.props.preload;\n if (this.props.poster !== void 0) video.poster = this.props.poster;\n this.props.onMount?.(this);\n return () => {\n video.removeEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.removeEventListener(\"play\", handlePlay);\n video.removeEventListener(\"pause\", handlePause);\n video.removeEventListener(\"ended\", handleEnded);\n video.removeEventListener(\"error\", handleError);\n video.removeEventListener(\"loadeddata\", handleLoadedData);\n };\n };\n this.play = () => {\n if (this.props.videoElement) {\n const video = this.props.videoElement;\n const hasValidSource = video.src || video.currentSrc && video.currentSrc !== \"\" || video.readyState >= 1;\n if (hasValidSource) {\n video.play()?.catch((error) => {\n console.error(\"[FilePlayer] Failed to play:\", error);\n this.props.onError?.(error);\n });\n } else {\n console.warn(\"[FilePlayer] Cannot play: video has no valid source\");\n }\n }\n };\n this.pause = () => {\n if (this.props.videoElement) {\n this.props.videoElement.pause();\n }\n };\n this.stop = () => {\n this.pause();\n if (this.props.videoElement) {\n this.props.videoElement.currentTime = 0;\n }\n };\n this.seekTo = (seconds, keepPlaying) => {\n if (this.props.videoElement) {\n this.props.videoElement.currentTime = seconds;\n if (!keepPlaying) {\n this.pause();\n }\n }\n };\n this.setVolume = (volume) => {\n if (this.props.videoElement) {\n this.props.videoElement.volume = Math.max(0, Math.min(1, volume));\n }\n };\n this.mute = () => {\n if (this.props.videoElement) {\n this.props.videoElement.muted = true;\n }\n };\n this.unmute = () => {\n if (this.props.videoElement) {\n this.props.videoElement.muted = false;\n }\n };\n this.setPlaybackRate = (rate) => {\n if (this.props.videoElement && rate > 0) {\n this.props.videoElement.playbackRate = rate;\n }\n };\n this.setLoop = (loop) => {\n if (this.props.videoElement) {\n this.props.videoElement.loop = loop;\n }\n };\n this.getDuration = () => {\n if (this.props.videoElement && isFinite(this.props.videoElement.duration)) {\n return this.props.videoElement.duration;\n }\n return null;\n };\n this.getCurrentTime = () => {\n if (this.props.videoElement && isFinite(this.props.videoElement.currentTime)) {\n return this.props.videoElement.currentTime;\n }\n return null;\n };\n this.getSecondsLoaded = () => {\n if (this.props.videoElement && this.props.videoElement.buffered.length > 0) {\n return this.props.videoElement.buffered.end(\n this.props.videoElement.buffered.length - 1\n );\n }\n return null;\n };\n this.getInternalPlayer = (key = \"player\") => {\n if (key === \"video\") return this.props.videoElement;\n return null;\n };\n this.enablePIP = async () => {\n if (this.props.videoElement && \"requestPictureInPicture\" in this.props.videoElement) {\n try {\n await this.props.videoElement.requestPictureInPicture();\n } catch (error) {\n console.warn(\"Picture-in-Picture failed:\", error);\n }\n }\n };\n this.disablePIP = async () => {\n if (document.pictureInPictureElement) {\n try {\n await document.exitPictureInPicture();\n } catch (error) {\n console.warn(\"Exit Picture-in-Picture failed:\", error);\n }\n }\n };\n }\n componentDidMount() {\n this.mounted = true;\n this.load();\n }\n componentWillUnmount() {\n this.mounted = false;\n }\n componentDidUpdate(prevProps) {\n if (prevProps.src !== this.props.src) {\n this.load();\n }\n }\n render() {\n return null;\n }\n};\nFilePlayer.displayName = \"FilePlayer\";\nFilePlayer.canPlay = canPlay.file;\n"]}
|
|
@@ -2475,12 +2475,12 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2475
2475
|
}
|
|
2476
2476
|
// src/sdk/prebid.ts
|
|
2477
2477
|
var DEFAULT_TIMEOUT_MS = 3e3;
|
|
2478
|
-
var
|
|
2479
|
-
function createPrebidManager(
|
|
2478
|
+
var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
|
|
2479
|
+
function createPrebidManager() {
|
|
2480
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2480
2481
|
var initialized = false;
|
|
2481
|
-
var
|
|
2482
|
-
var
|
|
2483
|
-
var debug = (_config_debug = config.debug) !== null && _config_debug !== void 0 ? _config_debug : false;
|
|
2482
|
+
var _options_debug;
|
|
2483
|
+
var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
|
|
2484
2484
|
function log() {
|
|
2485
2485
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
2486
2486
|
args[_key] = arguments[_key];
|
|
@@ -2501,49 +2501,6 @@ function createPrebidManager(config) {
|
|
|
2501
2501
|
"[Prebid]"
|
|
2502
2502
|
].concat(_to_consumable_array(args)));
|
|
2503
2503
|
}
|
|
2504
|
-
function resolveServerUrl() {
|
|
2505
|
-
var _config_ortbRequest_ext_prebid_server, _config_ortbRequest_ext_prebid, _config_ortbRequest_ext, _config_ortbRequest;
|
|
2506
|
-
if (config.serverUrl) {
|
|
2507
|
-
return config.serverUrl.replace(/\/$/, "");
|
|
2508
|
-
}
|
|
2509
|
-
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;
|
|
2510
|
-
if (typeof extUrl === "string" && extUrl.length > 0) {
|
|
2511
|
-
return extUrl.replace(/\/$/, "");
|
|
2512
|
-
}
|
|
2513
|
-
throw new Error("Prebid Server URL not configured. Provide serverUrl in PrebidConfig or ext.prebid.server.externalurl in the OpenRTB request.");
|
|
2514
|
-
}
|
|
2515
|
-
function buildRequest() {
|
|
2516
|
-
var req = JSON.parse(JSON.stringify(config.ortbRequest));
|
|
2517
|
-
req.id = "".concat(req.id || "prebid", "-").concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 8));
|
|
2518
|
-
if (!req.ext) req.ext = {};
|
|
2519
|
-
if (!req.ext.prebid) req.ext.prebid = {};
|
|
2520
|
-
if (!req.ext.prebid.cache) req.ext.prebid.cache = {};
|
|
2521
|
-
if (!req.ext.prebid.cache.vastxml) req.ext.prebid.cache.vastxml = {};
|
|
2522
|
-
if (!req.ext.prebid.targeting) {
|
|
2523
|
-
req.ext.prebid.targeting = {
|
|
2524
|
-
includewinners: true,
|
|
2525
|
-
includebidderkeys: false
|
|
2526
|
-
};
|
|
2527
|
-
}
|
|
2528
|
-
if (!req.device) req.device = {};
|
|
2529
|
-
if (typeof navigator !== "undefined") {
|
|
2530
|
-
if (!req.device.ua) req.device.ua = navigator.userAgent;
|
|
2531
|
-
if (!req.device.language) {
|
|
2532
|
-
req.device.language = (navigator.language || "").split("-")[0] || "en";
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
if (typeof window !== "undefined") {
|
|
2536
|
-
var _window_screen, _window_screen1;
|
|
2537
|
-
if (!req.device.w) req.device.w = ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.width) || window.innerWidth;
|
|
2538
|
-
if (!req.device.h) req.device.h = ((_window_screen1 = window.screen) === null || _window_screen1 === void 0 ? void 0 : _window_screen1.height) || window.innerHeight;
|
|
2539
|
-
}
|
|
2540
|
-
if (!req.site) req.site = {};
|
|
2541
|
-
if (typeof window !== "undefined") {
|
|
2542
|
-
if (!req.site.page) req.site.page = window.location.href;
|
|
2543
|
-
if (!req.site.domain) req.site.domain = window.location.hostname;
|
|
2544
|
-
}
|
|
2545
|
-
return req;
|
|
2546
|
-
}
|
|
2547
2504
|
function parseResponse(data) {
|
|
2548
2505
|
var bids = [];
|
|
2549
2506
|
var seatbids = (data === null || data === void 0 ? void 0 : data.seatbid) || [];
|
|
@@ -2613,12 +2570,6 @@ function createPrebidManager(config) {
|
|
|
2613
2570
|
function extractVastUrl(bids) {
|
|
2614
2571
|
if (bids.length === 0) return null;
|
|
2615
2572
|
var winner = bids[0];
|
|
2616
|
-
var _config_cpmFloor;
|
|
2617
|
-
var cpmFloor = (_config_cpmFloor = config.cpmFloor) !== null && _config_cpmFloor !== void 0 ? _config_cpmFloor : 0;
|
|
2618
|
-
if (cpmFloor > 0 && winner.cpm < cpmFloor) {
|
|
2619
|
-
log("Winning bid $".concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
|
|
2620
|
-
return null;
|
|
2621
|
-
}
|
|
2622
2573
|
if (winner.vastUrl) {
|
|
2623
2574
|
log("Using cached VAST URL from ".concat(winner.bidder, " ($").concat(winner.cpm.toFixed(2), " ").concat(winner.currency, ")"));
|
|
2624
2575
|
return winner.vastUrl;
|
|
@@ -2640,22 +2591,12 @@ function createPrebidManager(config) {
|
|
|
2640
2591
|
}
|
|
2641
2592
|
function initialize() {
|
|
2642
2593
|
return _async_to_generator(function() {
|
|
2643
|
-
var _config_ortbRequest;
|
|
2644
2594
|
return _ts_generator(this, function(_state) {
|
|
2645
2595
|
if (initialized) return [
|
|
2646
2596
|
2
|
|
2647
2597
|
];
|
|
2648
|
-
serverUrl = resolveServerUrl();
|
|
2649
|
-
if (!((_config_ortbRequest = config.ortbRequest) === null || _config_ortbRequest === void 0 ? void 0 : _config_ortbRequest.imp) || config.ortbRequest.imp.length === 0) {
|
|
2650
|
-
throw new Error("No impressions (imp) defined in the OpenRTB request.");
|
|
2651
|
-
}
|
|
2652
2598
|
initialized = true;
|
|
2653
|
-
log("Initialized
|
|
2654
|
-
log("Bidders:", config.ortbRequest.imp.map(function(imp) {
|
|
2655
|
-
var _imp_ext_prebid, _imp_ext;
|
|
2656
|
-
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;
|
|
2657
|
-
return bidders ? Object.keys(bidders).join(", ") : "none";
|
|
2658
|
-
}).join("; "));
|
|
2599
|
+
log("Initialized, auction URL:", AUCTION_URL);
|
|
2659
2600
|
return [
|
|
2660
2601
|
2
|
|
2661
2602
|
];
|
|
@@ -2664,17 +2605,15 @@ function createPrebidManager(config) {
|
|
|
2664
2605
|
}
|
|
2665
2606
|
function requestBids() {
|
|
2666
2607
|
return _async_to_generator(function() {
|
|
2667
|
-
var
|
|
2608
|
+
var timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, response, body, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
|
|
2668
2609
|
return _ts_generator(this, function(_state) {
|
|
2669
2610
|
switch(_state.label){
|
|
2670
2611
|
case 0:
|
|
2671
2612
|
if (!initialized) {
|
|
2672
2613
|
throw new Error("Prebid not initialized. Call initialize() first.");
|
|
2673
2614
|
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
timeout = (_ref = (_config_timeout = config.timeout) !== null && _config_timeout !== void 0 ? _config_timeout : config.ortbRequest.tmax) !== null && _ref !== void 0 ? _ref : DEFAULT_TIMEOUT_MS;
|
|
2677
|
-
log("Sending auction request to:", auctionUrl);
|
|
2615
|
+
timeout = DEFAULT_TIMEOUT_MS;
|
|
2616
|
+
log("Fetching auction response from:", AUCTION_URL);
|
|
2678
2617
|
controller = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
2679
2618
|
timeoutId = setTimeout(function() {
|
|
2680
2619
|
controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
@@ -2688,18 +2627,14 @@ function createPrebidManager(config) {
|
|
|
2688
2627
|
7
|
|
2689
2628
|
]);
|
|
2690
2629
|
fetchOptions = {
|
|
2691
|
-
method: "POST"
|
|
2692
|
-
headers: {
|
|
2693
|
-
"Content-Type": "application/json"
|
|
2694
|
-
},
|
|
2695
|
-
body: JSON.stringify(request)
|
|
2630
|
+
method: "POST"
|
|
2696
2631
|
};
|
|
2697
2632
|
if (controller) {
|
|
2698
2633
|
fetchOptions.signal = controller.signal;
|
|
2699
2634
|
}
|
|
2700
2635
|
return [
|
|
2701
2636
|
4,
|
|
2702
|
-
fetch(
|
|
2637
|
+
fetch(AUCTION_URL, fetchOptions)
|
|
2703
2638
|
];
|
|
2704
2639
|
case 2:
|
|
2705
2640
|
response = _state.sent();
|
|
@@ -2816,7 +2751,6 @@ function createPrebidManager(config) {
|
|
|
2816
2751
|
}
|
|
2817
2752
|
function destroy() {
|
|
2818
2753
|
initialized = false;
|
|
2819
|
-
serverUrl = "";
|
|
2820
2754
|
log("Destroyed");
|
|
2821
2755
|
}
|
|
2822
2756
|
return {
|
|
@@ -2832,7 +2766,7 @@ function createPrebidManager(config) {
|
|
|
2832
2766
|
// src/sdk/prebidController.ts
|
|
2833
2767
|
var import_hls2 = __toESM(require("hls.js"), 1);
|
|
2834
2768
|
var LOG = "[PrebidController]";
|
|
2835
|
-
function createPrebidController(contentVideo,
|
|
2769
|
+
function createPrebidController(contentVideo, options) {
|
|
2836
2770
|
var adPlaying = false;
|
|
2837
2771
|
var originalMutedState = false;
|
|
2838
2772
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -2846,11 +2780,9 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
2846
2780
|
var sessionId;
|
|
2847
2781
|
var destroyed = false;
|
|
2848
2782
|
var trackingFired = createEmptyTrackingState();
|
|
2849
|
-
var
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
debug: prebidDebug
|
|
2853
|
-
}));
|
|
2783
|
+
var prebidManager = createPrebidManager((options === null || options === void 0 ? void 0 : options.debug) !== void 0 ? {
|
|
2784
|
+
debug: options.debug
|
|
2785
|
+
} : {});
|
|
2854
2786
|
var prebidInitialized = false;
|
|
2855
2787
|
function emit(event, payload) {
|
|
2856
2788
|
var set = listeners.get(event);
|
|
@@ -3073,19 +3005,12 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
3073
3005
|
}
|
|
3074
3006
|
function ensurePrebidInitialized() {
|
|
3075
3007
|
return _async_to_generator(function() {
|
|
3076
|
-
var _prebidConfig_ortbRequest_imp, _prebidConfig_ortbRequest;
|
|
3077
3008
|
return _ts_generator(this, function(_state) {
|
|
3078
3009
|
switch(_state.label){
|
|
3079
3010
|
case 0:
|
|
3080
3011
|
if (prebidInitialized) return [
|
|
3081
3012
|
2
|
|
3082
3013
|
];
|
|
3083
|
-
if (prebidConfig.enabled === false) {
|
|
3084
|
-
throw new Error("Prebid is disabled in config");
|
|
3085
|
-
}
|
|
3086
|
-
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)) {
|
|
3087
|
-
throw new Error("No impressions configured in ortbRequest");
|
|
3088
|
-
}
|
|
3089
3014
|
return [
|
|
3090
3015
|
4,
|
|
3091
3016
|
prebidManager.initialize()
|
|
@@ -3103,7 +3028,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
3103
3028
|
}
|
|
3104
3029
|
function runPrebidAuction() {
|
|
3105
3030
|
return _async_to_generator(function() {
|
|
3106
|
-
var bids,
|
|
3031
|
+
var bids, winner;
|
|
3107
3032
|
return _ts_generator(this, function(_state) {
|
|
3108
3033
|
switch(_state.label){
|
|
3109
3034
|
case 0:
|
|
@@ -3126,15 +3051,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
|
|
|
3126
3051
|
null
|
|
3127
3052
|
];
|
|
3128
3053
|
}
|
|
3129
|
-
cpmFloor = (_prebidConfig_cpmFloor = prebidConfig.cpmFloor) !== null && _prebidConfig_cpmFloor !== void 0 ? _prebidConfig_cpmFloor : 0;
|
|
3130
3054
|
winner = bids[0];
|
|
3131
|
-
if (cpmFloor > 0 && winner.cpm < cpmFloor) {
|
|
3132
|
-
console.log("".concat(LOG, " Winning bid $").concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
|
|
3133
|
-
return [
|
|
3134
|
-
2,
|
|
3135
|
-
null
|
|
3136
|
-
];
|
|
3137
|
-
}
|
|
3138
3055
|
console.log("".concat(LOG, " Winning bid: ").concat(winner.bidder, " $").concat(winner.cpm.toFixed(2), " ").concat(winner.currency));
|
|
3139
3056
|
if (winner.vastXml) {
|
|
3140
3057
|
console.log("".concat(LOG, " Parsing VAST XML from bid response (inline)"));
|
|
@@ -4239,22 +4156,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4239
4156
|
adPlayerType = "hls";
|
|
4240
4157
|
}
|
|
4241
4158
|
if (adPlayerType === "prebid") {
|
|
4242
|
-
if (!this.config.prebid) {
|
|
4243
|
-
console.warn("[StormcloudVideoPlayer] adPlayerType is 'prebid' but no prebid config provided, falling back to HLS ad player");
|
|
4244
|
-
return createHlsAdPlayer(this.video, _object_spread({
|
|
4245
|
-
continueLiveStreamDuringAds: continueLiveStreamDuringAds
|
|
4246
|
-
}, this.config.licenseKey ? {
|
|
4247
|
-
licenseKey: this.config.licenseKey
|
|
4248
|
-
} : {}, this.hls ? {
|
|
4249
|
-
mainHlsInstance: this.hls
|
|
4250
|
-
} : {}));
|
|
4251
|
-
}
|
|
4252
4159
|
if (this.config.debugAdTiming) {
|
|
4253
4160
|
console.log("[StormcloudVideoPlayer] Creating Prebid ad controller (standalone, no IMA SDK)");
|
|
4254
4161
|
}
|
|
4255
|
-
return createPrebidController(this.video,
|
|
4162
|
+
return createPrebidController(this.video, _object_spread({
|
|
4256
4163
|
continueLiveStreamDuringAds: continueLiveStreamDuringAds
|
|
4257
|
-
}, this.config.
|
|
4164
|
+
}, this.config.debugAdTiming !== void 0 ? {
|
|
4165
|
+
debug: this.config.debugAdTiming
|
|
4166
|
+
} : {}, this.config.licenseKey ? {
|
|
4258
4167
|
licenseKey: this.config.licenseKey
|
|
4259
4168
|
} : {}, this.hls ? {
|
|
4260
4169
|
mainHlsInstance: this.hls
|