stormcloud-video-player 0.8.33 → 0.8.34
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 +38 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +38 -3
- package/lib/index.js.map +1 -1
- package/lib/player/AdConfigManager.cjs +36 -1
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +38 -3
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +38 -3
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +38 -3
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/pal.cjs +38 -2
- package/lib/sdk/pal.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +38 -3
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/devUrl.cjs +102 -0
- package/lib/utils/devUrl.cjs.map +1 -0
- package/lib/utils/devUrl.d.cts +4 -0
- package/package.json +1 -1
|
@@ -1613,6 +1613,41 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1613
1613
|
}
|
|
1614
1614
|
};
|
|
1615
1615
|
}
|
|
1616
|
+
// src/utils/devUrl.ts
|
|
1617
|
+
var PRIVATE_HOST_PATTERNS = [
|
|
1618
|
+
/^localhost$/i,
|
|
1619
|
+
/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
|
1620
|
+
/^0\.0\.0\.0$/,
|
|
1621
|
+
/^::1$/,
|
|
1622
|
+
/^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
|
1623
|
+
/^192\.168\.\d{1,3}\.\d{1,3}$/,
|
|
1624
|
+
/^172\.(1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}$/
|
|
1625
|
+
];
|
|
1626
|
+
function isLocalDevHost(hostname) {
|
|
1627
|
+
var host = hostname.replace(/^\[/, "").replace(/\]$/, "").toLowerCase();
|
|
1628
|
+
if (!host) return false;
|
|
1629
|
+
if (host.endsWith(".local") || host.endsWith(".localhost")) return true;
|
|
1630
|
+
return PRIVATE_HOST_PATTERNS.some(function(pattern) {
|
|
1631
|
+
return pattern.test(host);
|
|
1632
|
+
});
|
|
1633
|
+
}
|
|
1634
|
+
function toDevSafeUrl(rawUrl) {
|
|
1635
|
+
if (!rawUrl) return rawUrl !== null && rawUrl !== void 0 ? rawUrl : "";
|
|
1636
|
+
var url;
|
|
1637
|
+
try {
|
|
1638
|
+
url = new URL(rawUrl);
|
|
1639
|
+
} catch (unused) {
|
|
1640
|
+
return rawUrl;
|
|
1641
|
+
}
|
|
1642
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
1643
|
+
return rawUrl;
|
|
1644
|
+
}
|
|
1645
|
+
if (!isLocalDevHost(url.hostname)) {
|
|
1646
|
+
return rawUrl;
|
|
1647
|
+
}
|
|
1648
|
+
var cleanPath = url.pathname.replace(/\/{2,}/g, "/") || "/index.html";
|
|
1649
|
+
return "file://".concat(cleanPath);
|
|
1650
|
+
}
|
|
1616
1651
|
// src/sdk/pal.ts
|
|
1617
1652
|
var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
|
|
1618
1653
|
var _nonceLoader;
|
|
@@ -1699,12 +1734,12 @@ function createPalNonceManager() {
|
|
|
1699
1734
|
request.adWillPlayMuted = (_options_adWillPlayMuted = options.adWillPlayMuted) !== null && _options_adWillPlayMuted !== void 0 ? _options_adWillPlayMuted : false;
|
|
1700
1735
|
request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
|
|
1701
1736
|
request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
|
|
1702
|
-
request.descriptionUrl = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
|
|
1737
|
+
request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
1703
1738
|
request.iconsSupported = true;
|
|
1704
1739
|
request.playerType = "StormcloudVideoPlayer";
|
|
1705
1740
|
request.playerVersion = "1.0";
|
|
1706
1741
|
request.supportedApiFrameworks = "2,7,9";
|
|
1707
|
-
request.url = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
|
|
1742
|
+
request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
1708
1743
|
request.videoWidth = options.videoWidth || 640;
|
|
1709
1744
|
request.videoHeight = options.videoHeight || 480;
|
|
1710
1745
|
if (options.ppid) request.ppid = options.ppid;
|
|
@@ -5323,7 +5358,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5323
5358
|
podMaxDurationMs: podParams.maxDurationMs,
|
|
5324
5359
|
isCtv: envSignals.isCtv,
|
|
5325
5360
|
contentUrl: envSignals.contentUrl,
|
|
5326
|
-
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? window.location.href : void 0,
|
|
5361
|
+
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
|
|
5327
5362
|
adWillPlayMuted: adWillPlayMuted,
|
|
5328
5363
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5329
5364
|
appId: envSignals.appId,
|