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
package/lib/players/index.cjs
CHANGED
|
@@ -1649,6 +1649,41 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
};
|
|
1651
1651
|
}
|
|
1652
|
+
// src/utils/devUrl.ts
|
|
1653
|
+
var PRIVATE_HOST_PATTERNS = [
|
|
1654
|
+
/^localhost$/i,
|
|
1655
|
+
/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
|
1656
|
+
/^0\.0\.0\.0$/,
|
|
1657
|
+
/^::1$/,
|
|
1658
|
+
/^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
|
1659
|
+
/^192\.168\.\d{1,3}\.\d{1,3}$/,
|
|
1660
|
+
/^172\.(1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}$/
|
|
1661
|
+
];
|
|
1662
|
+
function isLocalDevHost(hostname) {
|
|
1663
|
+
var host = hostname.replace(/^\[/, "").replace(/\]$/, "").toLowerCase();
|
|
1664
|
+
if (!host) return false;
|
|
1665
|
+
if (host.endsWith(".local") || host.endsWith(".localhost")) return true;
|
|
1666
|
+
return PRIVATE_HOST_PATTERNS.some(function(pattern) {
|
|
1667
|
+
return pattern.test(host);
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
function toDevSafeUrl(rawUrl) {
|
|
1671
|
+
if (!rawUrl) return rawUrl !== null && rawUrl !== void 0 ? rawUrl : "";
|
|
1672
|
+
var url;
|
|
1673
|
+
try {
|
|
1674
|
+
url = new URL(rawUrl);
|
|
1675
|
+
} catch (unused) {
|
|
1676
|
+
return rawUrl;
|
|
1677
|
+
}
|
|
1678
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
1679
|
+
return rawUrl;
|
|
1680
|
+
}
|
|
1681
|
+
if (!isLocalDevHost(url.hostname)) {
|
|
1682
|
+
return rawUrl;
|
|
1683
|
+
}
|
|
1684
|
+
var cleanPath = url.pathname.replace(/\/{2,}/g, "/") || "/index.html";
|
|
1685
|
+
return "file://".concat(cleanPath);
|
|
1686
|
+
}
|
|
1652
1687
|
// src/sdk/pal.ts
|
|
1653
1688
|
var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
|
|
1654
1689
|
var _nonceLoader;
|
|
@@ -1735,12 +1770,12 @@ function createPalNonceManager() {
|
|
|
1735
1770
|
request.adWillPlayMuted = (_options_adWillPlayMuted = options.adWillPlayMuted) !== null && _options_adWillPlayMuted !== void 0 ? _options_adWillPlayMuted : false;
|
|
1736
1771
|
request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
|
|
1737
1772
|
request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
|
|
1738
|
-
request.descriptionUrl = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
|
|
1773
|
+
request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
1739
1774
|
request.iconsSupported = true;
|
|
1740
1775
|
request.playerType = "StormcloudVideoPlayer";
|
|
1741
1776
|
request.playerVersion = "1.0";
|
|
1742
1777
|
request.supportedApiFrameworks = "2,7,9";
|
|
1743
|
-
request.url = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
|
|
1778
|
+
request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
1744
1779
|
request.videoWidth = options.videoWidth || 640;
|
|
1745
1780
|
request.videoHeight = options.videoHeight || 480;
|
|
1746
1781
|
if (options.ppid) request.ppid = options.ppid;
|
|
@@ -5359,7 +5394,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5359
5394
|
podMaxDurationMs: podParams.maxDurationMs,
|
|
5360
5395
|
isCtv: envSignals.isCtv,
|
|
5361
5396
|
contentUrl: envSignals.contentUrl,
|
|
5362
|
-
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? window.location.href : void 0,
|
|
5397
|
+
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
|
|
5363
5398
|
adWillPlayMuted: adWillPlayMuted,
|
|
5364
5399
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5365
5400
|
appId: envSignals.appId,
|