stormcloud-video-player 0.8.32 → 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.
@@ -1,4 +1,4 @@
1
- import { b as AdBreak, S as StormcloudVideoPlayerConfig, A as AdController } from '../types-e6QV7SBp.cjs';
1
+ import { b as AdBreak, a as StormcloudVideoPlayerConfig, A as AdController } from '../types-CSHvCbhZ.cjs';
2
2
  import { PalNonceManager } from '../sdk/pal.cjs';
3
3
  import { VastConsentSignals } from '../utils/vastMacros.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as StormcloudVideoPlayerConfig, a as Scte35Marker, A as AdController } from '../types-e6QV7SBp.cjs';
1
+ import { a as StormcloudVideoPlayerConfig, S as Scte35Marker, A as AdController } from '../types-CSHvCbhZ.cjs';
2
2
 
3
3
  interface AdTimingCallbacks {
4
4
  onAdStopTimerFired(): void;
@@ -1,5 +1,5 @@
1
1
  import Hls from 'hls.js';
2
- import { S as StormcloudVideoPlayerConfig, a as Scte35Marker } from '../types-e6QV7SBp.cjs';
2
+ import { a as StormcloudVideoPlayerConfig, S as Scte35Marker } from '../types-CSHvCbhZ.cjs';
3
3
  import { Scte35CueContext } from './playerTypes.cjs';
4
4
  import { Scte35CueManager } from './Scte35CueManager.cjs';
5
5
  import { AdTimingService } from './AdTimingService.cjs';
@@ -1,4 +1,4 @@
1
- import { A as AdController } from '../types-e6QV7SBp.cjs';
1
+ import { A as AdController } from '../types-CSHvCbhZ.cjs';
2
2
 
3
3
  declare function getAdAudioVolume(adPlayer: AdController): number;
4
4
  declare function toggleMute(video: HTMLVideoElement, adPlayer: AdController, debug: boolean): void;
@@ -1,4 +1,4 @@
1
- import { a as Scte35Marker } from '../types-e6QV7SBp.cjs';
1
+ import { S as Scte35Marker } from '../types-CSHvCbhZ.cjs';
2
2
  import { Scte35CueSource, Scte35CueReadiness, Scte35CueContext } from './playerTypes.cjs';
3
3
 
4
4
  interface Scte35CueManagerCallbacks {
@@ -1,4 +1,4 @@
1
- import { a as Scte35Marker, I as Id3TagInfo } from '../types-e6QV7SBp.cjs';
1
+ import { S as Scte35Marker, I as Id3TagInfo } from '../types-CSHvCbhZ.cjs';
2
2
 
3
3
  declare function parseCueOutDuration(value: string): number | undefined;
4
4
  declare function parseCueOutCont(value: string): {
@@ -1562,6 +1562,41 @@ function createHlsAdPlayer(contentVideo, options) {
1562
1562
  }
1563
1563
  };
1564
1564
  }
1565
+ // src/utils/devUrl.ts
1566
+ var PRIVATE_HOST_PATTERNS = [
1567
+ /^localhost$/i,
1568
+ /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
1569
+ /^0\.0\.0\.0$/,
1570
+ /^::1$/,
1571
+ /^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
1572
+ /^192\.168\.\d{1,3}\.\d{1,3}$/,
1573
+ /^172\.(1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}$/
1574
+ ];
1575
+ function isLocalDevHost(hostname) {
1576
+ var host = hostname.replace(/^\[/, "").replace(/\]$/, "").toLowerCase();
1577
+ if (!host) return false;
1578
+ if (host.endsWith(".local") || host.endsWith(".localhost")) return true;
1579
+ return PRIVATE_HOST_PATTERNS.some(function(pattern) {
1580
+ return pattern.test(host);
1581
+ });
1582
+ }
1583
+ function toDevSafeUrl(rawUrl) {
1584
+ if (!rawUrl) return rawUrl !== null && rawUrl !== void 0 ? rawUrl : "";
1585
+ var url;
1586
+ try {
1587
+ url = new URL(rawUrl);
1588
+ } catch (unused) {
1589
+ return rawUrl;
1590
+ }
1591
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
1592
+ return rawUrl;
1593
+ }
1594
+ if (!isLocalDevHost(url.hostname)) {
1595
+ return rawUrl;
1596
+ }
1597
+ var cleanPath = url.pathname.replace(/\/{2,}/g, "/") || "/index.html";
1598
+ return "file://".concat(cleanPath);
1599
+ }
1565
1600
  // src/sdk/pal.ts
1566
1601
  var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
1567
1602
  var _nonceLoader;
@@ -1648,17 +1683,17 @@ function createPalNonceManager() {
1648
1683
  request.adWillPlayMuted = (_options_adWillPlayMuted = options.adWillPlayMuted) !== null && _options_adWillPlayMuted !== void 0 ? _options_adWillPlayMuted : false;
1649
1684
  request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
1650
1685
  request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
1651
- request.descriptionUrl = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
1686
+ request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
1652
1687
  request.iconsSupported = true;
1653
1688
  request.playerType = "StormcloudVideoPlayer";
1654
1689
  request.playerVersion = "1.0";
1655
1690
  request.supportedApiFrameworks = "2,7,9";
1656
- request.url = options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : "");
1691
+ request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
1657
1692
  request.videoWidth = options.videoWidth || 640;
1658
1693
  request.videoHeight = options.videoHeight || 480;
1659
1694
  if (options.ppid) request.ppid = options.ppid;
1660
1695
  if (options.sessionId) request.sessionId = options.sessionId;
1661
- console.log("[PAL] NonceRequest before generateNonce:", {
1696
+ console.log("[PAL] NonceRequest before generateNonce:", JSON.stringify({
1662
1697
  adWillAutoPlay: request.adWillAutoPlay,
1663
1698
  adWillPlayMuted: request.adWillPlayMuted,
1664
1699
  playerVolume: request.playerVolume,
@@ -1673,7 +1708,7 @@ function createPalNonceManager() {
1673
1708
  videoHeight: request.videoHeight,
1674
1709
  ppid: request.ppid,
1675
1710
  sessionId: request.sessionId
1676
- });
1711
+ }, null, 2));
1677
1712
  return [
1678
1713
  4,
1679
1714
  loader.loadNonceManager(request)
@@ -5272,7 +5307,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5272
5307
  podMaxDurationMs: podParams.maxDurationMs,
5273
5308
  isCtv: envSignals.isCtv,
5274
5309
  contentUrl: envSignals.contentUrl,
5275
- pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? window.location.href : void 0,
5310
+ pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
5276
5311
  adWillPlayMuted: adWillPlayMuted,
5277
5312
  adWillAutoPlay: !!this.config.autoplay,
5278
5313
  appId: envSignals.appId,