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/index.js
CHANGED
|
@@ -1583,6 +1583,41 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
|
+
// src/utils/devUrl.ts
|
|
1587
|
+
var PRIVATE_HOST_PATTERNS = [
|
|
1588
|
+
/^localhost$/i,
|
|
1589
|
+
/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
|
1590
|
+
/^0\.0\.0\.0$/,
|
|
1591
|
+
/^::1$/,
|
|
1592
|
+
/^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
|
1593
|
+
/^192\.168\.\d{1,3}\.\d{1,3}$/,
|
|
1594
|
+
/^172\.(1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}$/
|
|
1595
|
+
];
|
|
1596
|
+
function isLocalDevHost(hostname) {
|
|
1597
|
+
var host = hostname.replace(/^\[/, "").replace(/\]$/, "").toLowerCase();
|
|
1598
|
+
if (!host) return false;
|
|
1599
|
+
if (host.endsWith(".local") || host.endsWith(".localhost")) return true;
|
|
1600
|
+
return PRIVATE_HOST_PATTERNS.some(function(pattern) {
|
|
1601
|
+
return pattern.test(host);
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
function toDevSafeUrl(rawUrl) {
|
|
1605
|
+
if (!rawUrl) return rawUrl !== null && rawUrl !== void 0 ? rawUrl : "";
|
|
1606
|
+
var url;
|
|
1607
|
+
try {
|
|
1608
|
+
url = new URL(rawUrl);
|
|
1609
|
+
} catch (unused) {
|
|
1610
|
+
return rawUrl;
|
|
1611
|
+
}
|
|
1612
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
1613
|
+
return rawUrl;
|
|
1614
|
+
}
|
|
1615
|
+
if (!isLocalDevHost(url.hostname)) {
|
|
1616
|
+
return rawUrl;
|
|
1617
|
+
}
|
|
1618
|
+
var cleanPath = url.pathname.replace(/\/{2,}/g, "/") || "/index.html";
|
|
1619
|
+
return "file://".concat(cleanPath);
|
|
1620
|
+
}
|
|
1586
1621
|
// src/sdk/pal.ts
|
|
1587
1622
|
var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
|
|
1588
1623
|
var _nonceLoader;
|
|
@@ -1669,12 +1704,12 @@ function createPalNonceManager() {
|
|
|
1669
1704
|
request.adWillPlayMuted = (_options_adWillPlayMuted = options.adWillPlayMuted) !== null && _options_adWillPlayMuted !== void 0 ? _options_adWillPlayMuted : false;
|
|
1670
1705
|
request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
|
|
1671
1706
|
request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
|
|
1672
|
-
request.descriptionUrl = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
|
|
1707
|
+
request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
1673
1708
|
request.iconsSupported = true;
|
|
1674
1709
|
request.playerType = "StormcloudVideoPlayer";
|
|
1675
1710
|
request.playerVersion = "1.0";
|
|
1676
1711
|
request.supportedApiFrameworks = "2,7,9";
|
|
1677
|
-
request.url = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
|
|
1712
|
+
request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
1678
1713
|
request.videoWidth = options.videoWidth || 640;
|
|
1679
1714
|
request.videoHeight = options.videoHeight || 480;
|
|
1680
1715
|
if (options.ppid) request.ppid = options.ppid;
|
|
@@ -5345,7 +5380,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5345
5380
|
podMaxDurationMs: podParams.maxDurationMs,
|
|
5346
5381
|
isCtv: envSignals.isCtv,
|
|
5347
5382
|
contentUrl: envSignals.contentUrl,
|
|
5348
|
-
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? window.location.href : void 0,
|
|
5383
|
+
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
|
|
5349
5384
|
adWillPlayMuted: adWillPlayMuted,
|
|
5350
5385
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5351
5386
|
appId: envSignals.appId,
|