stormcloud-video-player 0.8.32 → 0.8.33

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.
@@ -1,4 +1,4 @@
1
- import { A as AdController } from '../types-e6QV7SBp.cjs';
1
+ import { A as AdController } from '../types-CSHvCbhZ.cjs';
2
2
  import Hls from 'hls.js';
3
3
 
4
4
  declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
package/lib/sdk/pal.cjs CHANGED
@@ -280,7 +280,7 @@ function createPalNonceManager() {
280
280
  request.videoHeight = options.videoHeight || 480;
281
281
  if (options.ppid) request.ppid = options.ppid;
282
282
  if (options.sessionId) request.sessionId = options.sessionId;
283
- console.log("[PAL] NonceRequest before generateNonce:", {
283
+ console.log("[PAL] NonceRequest before generateNonce:", JSON.stringify({
284
284
  adWillAutoPlay: request.adWillAutoPlay,
285
285
  adWillPlayMuted: request.adWillPlayMuted,
286
286
  playerVolume: request.playerVolume,
@@ -295,7 +295,7 @@ function createPalNonceManager() {
295
295
  videoHeight: request.videoHeight,
296
296
  ppid: request.ppid,
297
297
  sessionId: request.sessionId
298
- });
298
+ }, null, 2));
299
299
  return [
300
300
  4,
301
301
  loader.loadNonceManager(request)
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/ubuntu24-new/Dev/stormcloud-vp/lib/sdk/pal.cjs"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,6BAAA,QAAA,yBAAA;oCAAA;gBAAA;;;uGAAA,OAAA,WAAA,CAAA,SAAA;mCAAA;;wCAAA;gCAAA;;;;IAGP;IACA,OAAOD,kDAAAA;AACT,KAAA,CAAA,OAAA,OAAA,GAAA;IACA,uBAAA,EAAIM,eAAe,sBAACC;YAAQR,YAAYhB,UAAU,CAAC,GAAG,cAAc","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/sdk/pal.ts\nvar pal_exports = {};\n__export(pal_exports, {\n createPalNonceManager: () => createPalNonceManager\n});\nmodule.exports = __toCommonJS(pal_exports);\nvar PAL_SDK_URL = \"https://imasdk.googleapis.com/pal/sdkloader/pal.js\";\nvar _nonceLoader;\nvar _palLoadPromise;\nfunction loadPalSdk() {\n if (typeof window !== \"undefined\" && window.goog?.pal) {\n return Promise.resolve();\n }\n if (_palLoadPromise) return _palLoadPromise;\n _palLoadPromise = new Promise((resolve, reject) => {\n const existing = document.querySelector(\n 'script[data-pal=\"true\"]'\n );\n if (existing) {\n if (window.goog?.pal) {\n resolve();\n return;\n }\n const timeout = setTimeout(\n () => reject(new Error(\"PAL SDK load timeout\")),\n 1e4\n );\n existing.addEventListener(\"load\", () => {\n clearTimeout(timeout);\n resolve();\n });\n existing.addEventListener(\"error\", () => {\n clearTimeout(timeout);\n reject(new Error(\"PAL SDK load failed\"));\n });\n return;\n }\n const script = document.createElement(\"script\");\n script.src = PAL_SDK_URL;\n script.async = true;\n script.setAttribute(\"data-pal\", \"true\");\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(\"PAL SDK load failed\"));\n document.head.appendChild(script);\n });\n return _palLoadPromise;\n}\nfunction getOrCreateNonceLoader() {\n if (_nonceLoader) return _nonceLoader;\n const goog = window.goog;\n const consentSettings = new goog.pal.ConsentSettings();\n consentSettings.allowStorage = true;\n _nonceLoader = new goog.pal.NonceLoader(consentSettings);\n return _nonceLoader;\n}\nfunction createPalNonceManager() {\n let currentNonce = \"\";\n let currentNonceManager;\n return {\n async generateNonce(options = {}) {\n try {\n await loadPalSdk();\n const loader = getOrCreateNonceLoader();\n const goog = window.goog;\n const request = new goog.pal.NonceRequest();\n request.adWillAutoPlay = options.adWillAutoPlay ?? true;\n request.adWillPlayMuted = options.adWillPlayMuted ?? false;\n request.playerVolume = options.playerVolume ?? (request.adWillPlayMuted ? 0 : 1);\n request.continuousPlayback = options.continuousPlayback ?? true;\n request.descriptionUrl = options.descriptionUrl || (typeof window !== \"undefined\" ? window.location.href : \"\");\n request.iconsSupported = true;\n request.playerType = \"StormcloudVideoPlayer\";\n request.playerVersion = \"1.0\";\n request.supportedApiFrameworks = \"2,7,9\";\n request.url = options.descriptionUrl || (typeof window !== \"undefined\" ? window.location.href : \"\");\n request.videoWidth = options.videoWidth || 640;\n request.videoHeight = options.videoHeight || 480;\n if (options.ppid) request.ppid = options.ppid;\n if (options.sessionId) request.sessionId = options.sessionId;\n console.log(\"[PAL] NonceRequest before generateNonce:\", {\n adWillAutoPlay: request.adWillAutoPlay,\n adWillPlayMuted: request.adWillPlayMuted,\n playerVolume: request.playerVolume,\n continuousPlayback: request.continuousPlayback,\n descriptionUrl: request.descriptionUrl,\n iconsSupported: request.iconsSupported,\n playerType: request.playerType,\n playerVersion: request.playerVersion,\n supportedApiFrameworks: request.supportedApiFrameworks,\n url: request.url,\n videoWidth: request.videoWidth,\n videoHeight: request.videoHeight,\n ppid: request.ppid,\n sessionId: request.sessionId\n });\n const manager = await loader.loadNonceManager(request);\n currentNonceManager = manager;\n currentNonce = manager.getNonce();\n console.log(\"[PAL] Nonce generated successfully\");\n return currentNonce;\n } catch (error) {\n console.warn(\"[PAL] Failed to generate nonce:\", error);\n currentNonce = \"\";\n currentNonceManager = void 0;\n return \"\";\n }\n },\n getCurrentNonce() {\n return currentNonce;\n },\n injectNonce(vastTagUrl) {\n if (!currentNonce || !vastTagUrl) return vastTagUrl;\n try {\n const url = new URL(vastTagUrl);\n url.searchParams.delete(\"paln\");\n url.searchParams.set(\"givn\", currentNonce);\n return url.toString();\n } catch {\n let base = vastTagUrl.replace(/([?&])paln=[^&]*/g, \"\").replace(/[?&]$/, \"\");\n const sep = base.includes(\"?\") ? \"&\" : \"?\";\n return `${base}${sep}givn=${encodeURIComponent(currentNonce)}`;\n }\n },\n sendPlaybackStart() {\n try {\n currentNonceManager?.sendPlaybackStart();\n } catch {\n }\n },\n sendPlaybackEnd() {\n try {\n currentNonceManager?.sendPlaybackEnd();\n } catch {\n }\n },\n sendAdClick() {\n try {\n currentNonceManager?.sendAdClick();\n } catch {\n }\n },\n sendAdTouch(event) {\n try {\n currentNonceManager?.sendAdTouch(event);\n } catch {\n }\n },\n reset() {\n currentNonce = \"\";\n currentNonceManager = void 0;\n }\n };\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n createPalNonceManager\n});\n"]}
1
+ {"version":3,"sources":["/home/ubuntu24-new/Dev/stormcloud-vp/lib/sdk/pal.cjs"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AWI,IAAI,CAACG,IAAI;;sGAAEN,QAAAA,GAAY,CAAEK,CAAAA,OAAOjB,GAAAA,cAAiBe,MAAMG,IAAG,KAAMD,KAAKL,UAAU;+BAAC;gBAFpH,QAAK,YAAWV,kBAAkBa,0BAA7B,SAAA,6BAAA,QAAA,yBAAA;;kBAAA;8FAAA,gBAAA,WAAA;;yBAAA,6BAAA;8CAAA,CAAA;;;mCAAA,eAAA;;;;YAGP,sBAAA,KAAA;QACA,OAAOD;IACT;AACA,IAAIM,eAAe,sBAACC;WAAQR,YAAYhB,UAAU,CAAC,GAAG,cAAc,UAAA;QAAEyB,KAAAA,EAAO,KAAA,GAAA;6BAAK,IAAID","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/sdk/pal.ts\nvar pal_exports = {};\n__export(pal_exports, {\n createPalNonceManager: () => createPalNonceManager\n});\nmodule.exports = __toCommonJS(pal_exports);\nvar PAL_SDK_URL = \"https://imasdk.googleapis.com/pal/sdkloader/pal.js\";\nvar _nonceLoader;\nvar _palLoadPromise;\nfunction loadPalSdk() {\n if (typeof window !== \"undefined\" && window.goog?.pal) {\n return Promise.resolve();\n }\n if (_palLoadPromise) return _palLoadPromise;\n _palLoadPromise = new Promise((resolve, reject) => {\n const existing = document.querySelector(\n 'script[data-pal=\"true\"]'\n );\n if (existing) {\n if (window.goog?.pal) {\n resolve();\n return;\n }\n const timeout = setTimeout(\n () => reject(new Error(\"PAL SDK load timeout\")),\n 1e4\n );\n existing.addEventListener(\"load\", () => {\n clearTimeout(timeout);\n resolve();\n });\n existing.addEventListener(\"error\", () => {\n clearTimeout(timeout);\n reject(new Error(\"PAL SDK load failed\"));\n });\n return;\n }\n const script = document.createElement(\"script\");\n script.src = PAL_SDK_URL;\n script.async = true;\n script.setAttribute(\"data-pal\", \"true\");\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(\"PAL SDK load failed\"));\n document.head.appendChild(script);\n });\n return _palLoadPromise;\n}\nfunction getOrCreateNonceLoader() {\n if (_nonceLoader) return _nonceLoader;\n const goog = window.goog;\n const consentSettings = new goog.pal.ConsentSettings();\n consentSettings.allowStorage = true;\n _nonceLoader = new goog.pal.NonceLoader(consentSettings);\n return _nonceLoader;\n}\nfunction createPalNonceManager() {\n let currentNonce = \"\";\n let currentNonceManager;\n return {\n async generateNonce(options = {}) {\n try {\n await loadPalSdk();\n const loader = getOrCreateNonceLoader();\n const goog = window.goog;\n const request = new goog.pal.NonceRequest();\n request.adWillAutoPlay = options.adWillAutoPlay ?? true;\n request.adWillPlayMuted = options.adWillPlayMuted ?? false;\n request.playerVolume = options.playerVolume ?? (request.adWillPlayMuted ? 0 : 1);\n request.continuousPlayback = options.continuousPlayback ?? true;\n request.descriptionUrl = options.descriptionUrl || (typeof window !== \"undefined\" ? window.location.href : \"\");\n request.iconsSupported = true;\n request.playerType = \"StormcloudVideoPlayer\";\n request.playerVersion = \"1.0\";\n request.supportedApiFrameworks = \"2,7,9\";\n request.url = options.descriptionUrl || (typeof window !== \"undefined\" ? window.location.href : \"\");\n request.videoWidth = options.videoWidth || 640;\n request.videoHeight = options.videoHeight || 480;\n if (options.ppid) request.ppid = options.ppid;\n if (options.sessionId) request.sessionId = options.sessionId;\n console.log(\n \"[PAL] NonceRequest before generateNonce:\",\n JSON.stringify({\n adWillAutoPlay: request.adWillAutoPlay,\n adWillPlayMuted: request.adWillPlayMuted,\n playerVolume: request.playerVolume,\n continuousPlayback: request.continuousPlayback,\n descriptionUrl: request.descriptionUrl,\n iconsSupported: request.iconsSupported,\n playerType: request.playerType,\n playerVersion: request.playerVersion,\n supportedApiFrameworks: request.supportedApiFrameworks,\n url: request.url,\n videoWidth: request.videoWidth,\n videoHeight: request.videoHeight,\n ppid: request.ppid,\n sessionId: request.sessionId\n }, null, 2)\n );\n const manager = await loader.loadNonceManager(request);\n currentNonceManager = manager;\n currentNonce = manager.getNonce();\n console.log(\"[PAL] Nonce generated successfully\");\n return currentNonce;\n } catch (error) {\n console.warn(\"[PAL] Failed to generate nonce:\", error);\n currentNonce = \"\";\n currentNonceManager = void 0;\n return \"\";\n }\n },\n getCurrentNonce() {\n return currentNonce;\n },\n injectNonce(vastTagUrl) {\n if (!currentNonce || !vastTagUrl) return vastTagUrl;\n try {\n const url = new URL(vastTagUrl);\n url.searchParams.delete(\"paln\");\n url.searchParams.set(\"givn\", currentNonce);\n return url.toString();\n } catch {\n let base = vastTagUrl.replace(/([?&])paln=[^&]*/g, \"\").replace(/[?&]$/, \"\");\n const sep = base.includes(\"?\") ? \"&\" : \"?\";\n return `${base}${sep}givn=${encodeURIComponent(currentNonce)}`;\n }\n },\n sendPlaybackStart() {\n try {\n currentNonceManager?.sendPlaybackStart();\n } catch {\n }\n },\n sendPlaybackEnd() {\n try {\n currentNonceManager?.sendPlaybackEnd();\n } catch {\n }\n },\n sendAdClick() {\n try {\n currentNonceManager?.sendAdClick();\n } catch {\n }\n },\n sendAdTouch(event) {\n try {\n currentNonceManager?.sendAdTouch(event);\n } catch {\n }\n },\n reset() {\n currentNonce = \"\";\n currentNonceManager = void 0;\n }\n };\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n createPalNonceManager\n});\n"]}
@@ -1695,7 +1695,7 @@ function createPalNonceManager() {
1695
1695
  request.videoHeight = options.videoHeight || 480;
1696
1696
  if (options.ppid) request.ppid = options.ppid;
1697
1697
  if (options.sessionId) request.sessionId = options.sessionId;
1698
- console.log("[PAL] NonceRequest before generateNonce:", {
1698
+ console.log("[PAL] NonceRequest before generateNonce:", JSON.stringify({
1699
1699
  adWillAutoPlay: request.adWillAutoPlay,
1700
1700
  adWillPlayMuted: request.adWillPlayMuted,
1701
1701
  playerVolume: request.playerVolume,
@@ -1710,7 +1710,7 @@ function createPalNonceManager() {
1710
1710
  videoHeight: request.videoHeight,
1711
1711
  ppid: request.ppid,
1712
1712
  sessionId: request.sessionId
1713
- });
1713
+ }, null, 2));
1714
1714
  return [
1715
1715
  4,
1716
1716
  loader.loadNonceManager(request)