@arcware-cloud/pixelstreaming-websdk 1.3.15 → 1.3.18

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/index.esm.js CHANGED
@@ -23356,7 +23356,7 @@ __webpack_require__.r(__webpack_exports__);
23356
23356
  /* harmony export */ "ArcwareConfig": () => (/* binding */ ArcwareConfig),
23357
23357
  /* harmony export */ "DefaultUrl": () => (/* binding */ DefaultUrl)
23358
23358
  /* harmony export */ });
23359
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(655);
23359
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(655);
23360
23360
  /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1604);
23361
23361
  /* harmony import */ var _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7800);
23362
23362
  /* harmony import */ var _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7463);
@@ -23364,6 +23364,8 @@ __webpack_require__.r(__webpack_exports__);
23364
23364
  /* harmony import */ var _domain_ArcwareSettingsSchema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5602);
23365
23365
  /* harmony import */ var _features_whiteLabelling__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3545);
23366
23366
  /* harmony import */ var _features_ZWhiteLabel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(467);
23367
+ /* harmony import */ var _domain_EventHandler__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3379);
23368
+
23367
23369
 
23368
23370
 
23369
23371
 
@@ -23386,6 +23388,14 @@ Logger.Error = (message: string) => {
23386
23388
  console.error(message);
23387
23389
  };*/
23388
23390
  _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_4__.Logger.InitLogging(2, false);
23391
+ function deepEqual(a, b) {
23392
+ try {
23393
+ return JSON.stringify(a) === JSON.stringify(b);
23394
+ }
23395
+ catch (_a) {
23396
+ return false;
23397
+ }
23398
+ }
23389
23399
  class ArcwareConfig extends _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_5__.Config {
23390
23400
  /**
23391
23401
  * Can be used to fetch projectId and shareId from the current url.
@@ -23434,7 +23444,13 @@ class ArcwareConfig extends _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBP
23434
23444
  if (!config.initialSettings.ss)
23435
23445
  config.initialSettings.ss = DefaultUrl;
23436
23446
  super(config);
23437
- this.VERSION = "1.3.15";
23447
+ this.VERSION = "1.3.18";
23448
+ this.whiteLabellingChanged = new _domain_EventHandler__WEBPACK_IMPORTED_MODULE_7__.EventHandler();
23449
+ this.signallingWlURL = "https://signalling-client.arcware.cloud/whiteLabel/";
23450
+ console.log(config);
23451
+ if (config.envName) {
23452
+ this.signallingWlURL = `https://signalling-client.${config.envName}.arcware.cloud/whiteLabel/`;
23453
+ }
23438
23454
  this.settings = settings;
23439
23455
  this.session = new _domain_Session__WEBPACK_IMPORTED_MODULE_0__.Session();
23440
23456
  this._initialSettings = config.initialSettings;
@@ -23456,58 +23472,54 @@ class ArcwareConfig extends _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBP
23456
23472
  this.settings.infoButton = qs.has("i") || qs.has("info");
23457
23473
  }
23458
23474
  }
23459
- static getWhiteLabelling(ShareId, URL = "https://signalling-client.arcware.cloud/whiteLabel/") {
23460
- return (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__awaiter)(this, void 0, void 0, function* () {
23475
+ getWhiteLabelling(ShareId) {
23476
+ return (0,tslib__WEBPACK_IMPORTED_MODULE_8__.__awaiter)(this, void 0, void 0, function* () {
23461
23477
  const qs = new URLSearchParams(window.location.search);
23462
- if (qs.has("wl") && qs.get("wl") === "") {
23463
- // Build final URL safely (trim trailing slashes, encode ShareId)
23464
- const base = URL.replace(/\/+$/, "");
23465
- const requestUrl = `${base}/${encodeURIComponent(ShareId)}`;
23466
- const controller = new AbortController();
23467
- const timeoutId = setTimeout(() => controller.abort(), 1000);
23478
+ // Only fetch when wl param is present and empty (as before)
23479
+ if (!(qs.has("wl") && qs.get("wl") === ""))
23480
+ return undefined;
23481
+ // Build final URL safely (trim trailing slashes, encode ShareId)
23482
+ const base = this.signallingWlURL.replace(/\/+$/, "");
23483
+ const requestUrl = `${base}/${encodeURIComponent(ShareId)}`;
23484
+ const controller = new AbortController();
23485
+ const timeoutId = setTimeout(() => controller.abort(), 1000);
23486
+ try {
23487
+ const res = yield fetch(requestUrl, {
23488
+ method: "GET",
23489
+ signal: controller.signal,
23490
+ headers: { Accept: "application/json, text/plain" },
23491
+ credentials: "omit"
23492
+ });
23493
+ if (!res.ok)
23494
+ return undefined;
23495
+ const text = yield res.text();
23496
+ if (!text || text.trim() === "")
23497
+ return undefined;
23498
+ let json;
23468
23499
  try {
23469
- const res = yield fetch(requestUrl, {
23470
- method: "GET",
23471
- signal: controller.signal,
23472
- headers: { Accept: "application/json, text/plain" },
23473
- credentials: "omit"
23474
- });
23475
- if (!res.ok) {
23476
- // Non-2xx: treat as “no white label”
23477
- return undefined;
23478
- }
23479
- // We read as text first to detect empty-string payloads
23480
- const text = yield res.text();
23481
- if (!text || text.trim() === "") {
23482
- return undefined;
23483
- }
23484
- // If there is content, try to parse JSON
23485
- let json;
23486
- try {
23487
- json = JSON.parse(text);
23488
- }
23489
- catch (_a) {
23490
- // Not valid JSON → ignore
23491
- return undefined;
23492
- }
23493
- // Validate against the allowlisted schema
23494
- const parsed = _features_ZWhiteLabel__WEBPACK_IMPORTED_MODULE_3__.ZWhiteLabel.safeParse(json);
23495
- if (!parsed.success) {
23496
- // Optionally log parsed.error for diagnostics
23497
- return undefined;
23498
- }
23499
- return parsed.data;
23500
+ json = JSON.parse(text);
23500
23501
  }
23501
- catch (err) {
23502
- // Abort or network error → treat as “no white label”
23503
- // if (err?.name !== "AbortError") console.warn("getWhiteLabelling failed", err);
23502
+ catch (_a) {
23504
23503
  return undefined;
23505
23504
  }
23506
- finally {
23507
- clearTimeout(timeoutId);
23505
+ const parsed = _features_ZWhiteLabel__WEBPACK_IMPORTED_MODULE_3__.ZWhiteLabel.safeParse(json);
23506
+ if (!parsed.success)
23507
+ return undefined;
23508
+ // Only apply & emit if it actually changed
23509
+ const prev = this.settings.whiteLabelling;
23510
+ const next = parsed.data;
23511
+ if (!deepEqual(prev, next)) {
23512
+ this.settings.whiteLabelling = next;
23513
+ _domain_EventHandler__WEBPACK_IMPORTED_MODULE_7__.EventHandler.Emit(this.whiteLabellingChanged, next);
23508
23514
  }
23515
+ return parsed.data;
23516
+ }
23517
+ catch (_b) {
23518
+ return undefined;
23519
+ }
23520
+ finally {
23521
+ clearTimeout(timeoutId);
23509
23522
  }
23510
- return undefined;
23511
23523
  });
23512
23524
  }
23513
23525
  /** Setup connection string. */
@@ -23587,6 +23599,7 @@ let globalApplication = null;
23587
23599
  let previousShareId = null;
23588
23600
  let previousProjectId = null;
23589
23601
  function ArcwareInit({ shareId, projectId }, configuration, forceRefresh = false) {
23602
+ var _a;
23590
23603
  if (shareId && !shareId.startsWith("share-"))
23591
23604
  throw new Error(`Unexpected shareId-format: '${shareId}'.`);
23592
23605
  if (shareId && previousShareId !== shareId) {
@@ -23626,7 +23639,8 @@ function ArcwareInit({ shareId, projectId }, configuration, forceRefresh = false
23626
23639
  splashScreenMode: undefined,
23627
23640
  splashScreenPosition: undefined,
23628
23641
  splashScreenBgColor: undefined
23629
- } }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23642
+ } }, configuration === null || configuration === void 0 ? void 0 : configuration.settings),
23643
+ envName: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.envName) !== null && _a !== void 0 ? _a : undefined
23630
23644
  });
23631
23645
  const PixelStreaming = new _ArcwarePixelStreaming__WEBPACK_IMPORTED_MODULE_1__.ArcwarePixelStreaming(Config);
23632
23646
  const Application = new _ArcwareApplication__WEBPACK_IMPORTED_MODULE_2__.ArcwareApplication({ stream: PixelStreaming });
@@ -23651,7 +23665,7 @@ __webpack_require__.r(__webpack_exports__);
23651
23665
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23652
23666
  /* harmony export */ "ArcwarePixelStreaming": () => (/* binding */ ArcwarePixelStreaming)
23653
23667
  /* harmony export */ });
23654
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(655);
23668
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(655);
23655
23669
  /* harmony import */ var _arcware_cloud_shared_pixelstreaming_websdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7910);
23656
23670
  /* harmony import */ var _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(516);
23657
23671
  /* harmony import */ var _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7800);
@@ -23659,10 +23673,10 @@ __webpack_require__.r(__webpack_exports__);
23659
23673
  /* harmony import */ var _ApplyUrlHack__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4790);
23660
23674
  /* harmony import */ var _domain_EventHandler__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3379);
23661
23675
  /* harmony import */ var _domain_Stats__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9764);
23662
- /* harmony import */ var _domain_debounce__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9580);
23676
+ /* harmony import */ var _domain_debounce__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(9580);
23663
23677
  /* harmony import */ var _ui_LoveLetters__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4572);
23664
23678
  /* harmony import */ var _ui_ArcwareLogoLoader__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6469);
23665
- /* harmony import */ var _ui_MicrophoneOverlay__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3613);
23679
+ /* harmony import */ var _ui_MicrophoneOverlay__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3613);
23666
23680
  /* harmony import */ var _domain_ConnectionIdentifier__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5999);
23667
23681
  /* harmony import */ var _features_DiagnosticsCollector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8429);
23668
23682
  /* harmony import */ var _features_common__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2483);
@@ -23809,8 +23823,34 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
23809
23823
  });
23810
23824
  // Set override config.
23811
23825
  this.config = config;
23826
+ // Re-apply branding whenever config's WL changes
23827
+ this.config.whiteLabellingChanged.add(() => {
23828
+ try {
23829
+ this.applyBrandingFromSettings();
23830
+ }
23831
+ catch (_a) { }
23832
+ });
23833
+ // Kick off WL fetch once (if we have a shareId); on success it will emit and re-apply
23834
+ (() => (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__awaiter)(this, void 0, void 0, function* () {
23835
+ try {
23836
+ const sid = this.config.settings.shareId;
23837
+ if (sid) {
23838
+ yield this.config.getWhiteLabelling(sid); // will emit if it changes
23839
+ }
23840
+ }
23841
+ catch (_d) {
23842
+ // ignore
23843
+ }
23844
+ finally {
23845
+ // Make sure we paint with whatever we have initially
23846
+ try {
23847
+ this.applyBrandingFromSettings();
23848
+ }
23849
+ catch (_e) { }
23850
+ }
23851
+ }))();
23812
23852
  this.loveLettersList = [];
23813
- this.microphoneOverlay = new _ui_MicrophoneOverlay__WEBPACK_IMPORTED_MODULE_7__.MicrophoneOverlay(this);
23853
+ this.microphoneOverlay = new _ui_MicrophoneOverlay__WEBPACK_IMPORTED_MODULE_8__.MicrophoneOverlay(this);
23814
23854
  this.diagnosticsCollector = new _features_DiagnosticsCollector__WEBPACK_IMPORTED_MODULE_3__.DiagnosticsCollector({
23815
23855
  enableBandwidthProbe: false
23816
23856
  });
@@ -23833,7 +23873,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
23833
23873
  this.addMessageHandler("version", _arcware_cloud_shared_pixelstreaming_websdk__WEBPACK_IMPORTED_MODULE_0__.Messages.ZVersion, this.onVersion);
23834
23874
  this.addMessageHandler("render", _arcware_cloud_shared_pixelstreaming_websdk__WEBPACK_IMPORTED_MODULE_0__.Messages.ZRender, this.onRender);
23835
23875
  // Create a debounced version of the handleResolutionChange function
23836
- const debouncedResolutionChange = (0,_domain_debounce__WEBPACK_IMPORTED_MODULE_8__["default"])(() => {
23876
+ const debouncedResolutionChange = (0,_domain_debounce__WEBPACK_IMPORTED_MODULE_9__["default"])(() => {
23837
23877
  this.handleResolutionChange();
23838
23878
  }, 0);
23839
23879
  // Register event listeners.
@@ -23879,7 +23919,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
23879
23919
  /** On version requested, the version of the WebSDK would be returned. */
23880
23920
  onVersion(_msg) {
23881
23921
  var _a, _b;
23882
- return (0,tslib__WEBPACK_IMPORTED_MODULE_9__.__awaiter)(this, void 0, void 0, function* () {
23922
+ return (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__awaiter)(this, void 0, void 0, function* () {
23883
23923
  let diagnostics;
23884
23924
  try {
23885
23925
  diagnostics = yield this.diagnosticsCollector.collect();
@@ -23909,7 +23949,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
23909
23949
  }
23910
23950
  waitForFirstFrameWithTimeout(ms = 2000) {
23911
23951
  var _a, _b, _c;
23912
- return (0,tslib__WEBPACK_IMPORTED_MODULE_9__.__awaiter)(this, void 0, void 0, function* () {
23952
+ return (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__awaiter)(this, void 0, void 0, function* () {
23913
23953
  const video = (_c = (_b = (_a = this.webRtcController) === null || _a === void 0 ? void 0 : _a.videoPlayer) === null || _b === void 0 ? void 0 : _b.getVideoElement) === null || _c === void 0 ? void 0 : _c.call(_b);
23914
23954
  if (this.isVideoRenderingNow(video))
23915
23955
  return true;
@@ -23947,7 +23987,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
23947
23987
  });
23948
23988
  }
23949
23989
  onRender(_msg) {
23950
- return (0,tslib__WEBPACK_IMPORTED_MODULE_9__.__awaiter)(this, void 0, void 0, function* () {
23990
+ return (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__awaiter)(this, void 0, void 0, function* () {
23951
23991
  const isRendering = yield this.waitForFirstFrameWithTimeout();
23952
23992
  const payload = {
23953
23993
  type: "render",
@@ -23990,7 +24030,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
23990
24030
  });
23991
24031
  }
23992
24032
  }
23993
- this.applyBrandingFromSettings();
24033
+ //this.applyBrandingFromSettings();
23994
24034
  this.handleMouseLock();
23995
24035
  this.injectCustomUI();
23996
24036
  }
@@ -24041,34 +24081,38 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24041
24081
  }
24042
24082
  }
24043
24083
  runPostInitSideEffectsOnce() {
24044
- var _a, _b, _c, _d, _e, _f, _g;
24084
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24045
24085
  if (this._postInitSideEffectsDone)
24046
24086
  return;
24047
24087
  this._postInitSideEffectsDone = true;
24048
24088
  try {
24049
24089
  (_a = this.handleMouseLock) === null || _a === void 0 ? void 0 : _a.call(this);
24050
24090
  }
24051
- catch (_h) { }
24091
+ catch (_j) { }
24052
24092
  try {
24053
24093
  (_b = this.handleResolutionChange) === null || _b === void 0 ? void 0 : _b.call(this);
24054
24094
  }
24055
- catch (_j) { }
24095
+ catch (_k) { }
24056
24096
  try {
24057
24097
  (_c = this.handleRemoveLoveLetters) === null || _c === void 0 ? void 0 : _c.call(this);
24058
24098
  }
24059
- catch (_k) { }
24099
+ catch (_l) { }
24060
24100
  try {
24061
24101
  (_e = (_d = this.microphoneOverlay) === null || _d === void 0 ? void 0 : _d.toggleVisibility) === null || _e === void 0 ? void 0 : _e.call(_d, false);
24062
24102
  }
24063
- catch (_l) { }
24103
+ catch (_m) { }
24064
24104
  try {
24065
24105
  (_f = this.applyResolutionIfPlaying) === null || _f === void 0 ? void 0 : _f.call(this);
24066
24106
  }
24067
- catch (_m) { }
24107
+ catch (_o) { }
24068
24108
  try {
24069
24109
  (_g = this.removeXRIconIfDisabled) === null || _g === void 0 ? void 0 : _g.call(this);
24070
24110
  }
24071
- catch (_o) { }
24111
+ catch (_p) { }
24112
+ try {
24113
+ (_h = this.hideSplashVideo) === null || _h === void 0 ? void 0 : _h.call(this);
24114
+ }
24115
+ catch (_q) { } // ← hide splash video when streaming
24072
24116
  }
24073
24117
  onVideoInitialized() {
24074
24118
  if (this.videoInitializedSent) {
@@ -24332,8 +24376,6 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24332
24376
  (_a = logoLoader.setHostElement) === null || _a === void 0 ? void 0 : _a.call(logoLoader, loaderRoot);
24333
24377
  loveLettersContainer.appendChild(lettersBlock);
24334
24378
  lettersBlock.appendChild(lettersWrapper);
24335
- // apply current (local) settings immediately
24336
- this.applyBrandingFromSettings();
24337
24379
  }
24338
24380
  }
24339
24381
  pushLetter(letter) {
@@ -24450,7 +24492,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24450
24492
  applyBrandingFromSettings() {
24451
24493
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
24452
24494
  const cfg = ((_b = (_a = this === null || this === void 0 ? void 0 : this.config) === null || _a === void 0 ? void 0 : _a.settings.whiteLabelling) !== null && _b !== void 0 ? _b : {});
24453
- // Loader image + fade
24495
+ // Loader
24454
24496
  try {
24455
24497
  if (this.logoLoader) {
24456
24498
  (_d = (_c = this.logoLoader).setImage) === null || _d === void 0 ? void 0 : _d.call(_c, cfg.loadingIconUrl);
@@ -24458,68 +24500,149 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24458
24500
  }
24459
24501
  }
24460
24502
  catch (_q) { }
24461
- // Pick splash host: loveLettersContainer (preferred) or player parent
24462
- try {
24463
- const el = (_m = (_g = this.loveLettersContainer) !== null && _g !== void 0 ? _g : (_l = (_k = (_j = (_h = this.webRtcController) === null || _h === void 0 ? void 0 : _h.videoPlayer) === null || _j === void 0 ? void 0 : _j.getVideoParentElement) === null || _k === void 0 ? void 0 : _k.call(_j)) === null || _l === void 0 ? void 0 : _l.parentElement) !== null && _m !== void 0 ? _m : null;
24464
- if (!el)
24465
- return;
24466
- const s = el.style;
24467
- // Nuke previous inline styles (longhands only; never touch 'background' shorthand here)
24468
- s.removeProperty("background-image");
24469
- s.removeProperty("background-size");
24470
- s.removeProperty("background-repeat");
24471
- s.removeProperty("background-position");
24472
- s.removeProperty("background-color");
24473
- // Also clear any earlier 'background' inline shorthand that might have been set elsewhere
24474
- // (we set to 'initial' first, then re-apply longhands)
24475
- s.setProperty("background", "initial");
24476
- el.classList.remove("aw-splash");
24477
- // If neither color nor image is provided, nothing to do
24478
- const haveColor = !!cfg.splashScreenBgColor;
24479
- const haveImage = !!cfg.splashScreenUrl;
24480
- if (!haveColor && !haveImage)
24481
- return;
24482
- // Always ensure our class is present when we brand
24483
- el.classList.add("aw-splash");
24484
- // Apply color with !important so external 'background: ... !important' can't wipe it
24485
- const bgColor = (_o = cfg.splashScreenBgColor) !== null && _o !== void 0 ? _o : "var(--color0)";
24486
- s.setProperty("background-color", bgColor, "important");
24487
- if (haveImage) {
24488
- // Mode size/repeat mapping
24489
- const mode = ((_p = cfg.splashScreenMode) !== null && _p !== void 0 ? _p : "contain");
24490
- switch (mode) {
24491
- case "contain":
24492
- s.backgroundSize = "contain";
24493
- s.backgroundRepeat = "no-repeat";
24494
- break;
24495
- case "cover":
24496
- s.backgroundSize = "cover";
24497
- s.backgroundRepeat = "no-repeat";
24498
- break;
24499
- case "stretch":
24500
- s.backgroundSize = "100% 100%";
24501
- s.backgroundRepeat = "no-repeat";
24502
- break;
24503
- case "repeat":
24504
- s.backgroundSize = "auto"; // intrinsic
24505
- s.backgroundRepeat = "repeat";
24506
- break;
24507
- }
24508
- // Position
24509
- s.backgroundPosition = cfg.splashScreenPosition || "center center";
24510
- // Image last (longhand so it won't reset color)
24511
- // Use quotes to be safe with URLs containing parentheses/spaces
24512
- s.backgroundImage = `url("${cfg.splashScreenUrl}")`;
24503
+ const host = (_m = (_g = this.loveLettersContainer) !== null && _g !== void 0 ? _g : (_l = (_k = (_j = (_h = this.webRtcController) === null || _h === void 0 ? void 0 : _h.videoPlayer) === null || _j === void 0 ? void 0 : _j.getVideoParentElement) === null || _k === void 0 ? void 0 : _k.call(_j)) === null || _l === void 0 ? void 0 : _l.parentElement) !== null && _m !== void 0 ? _m : null;
24504
+ if (!host)
24505
+ return;
24506
+ const s = host.style;
24507
+ // Reset background longhands (never use shorthand to avoid nuking color)
24508
+ s.removeProperty("background-image");
24509
+ s.removeProperty("background-size");
24510
+ s.removeProperty("background-repeat");
24511
+ s.removeProperty("background-position");
24512
+ s.removeProperty("background-color");
24513
+ s.setProperty("background", "initial");
24514
+ host.classList.remove("aw-splash");
24515
+ // Clear any previous splash video unless re-used below
24516
+ this.destroySplashVideo();
24517
+ const haveUrl = !!cfg.splashScreenUrl;
24518
+ const haveColor = !!cfg.splashScreenBgColor;
24519
+ // Nothing to apply?
24520
+ if (!haveUrl && !haveColor)
24521
+ return;
24522
+ host.classList.add("aw-splash");
24523
+ // Always apply color (visible behind image/video / letterboxing)
24524
+ const bgColor = (_o = cfg.splashScreenBgColor) !== null && _o !== void 0 ? _o : "var(--color0)";
24525
+ s.setProperty("background-color", bgColor, "important");
24526
+ // Decide: video or image from the same URL
24527
+ const isVideo = this.isVideoUrl(cfg.splashScreenUrl);
24528
+ if (haveUrl && isVideo) {
24529
+ // map splashScreenMode to object-fit
24530
+ const fit = cfg.splashScreenMode === "cover" ? "cover" : cfg.splashScreenMode === "stretch" ? "fill" : "contain";
24531
+ const pos = cfg.splashScreenPosition || "center center";
24532
+ this.upsertSplashVideo(cfg.splashScreenUrl, { fit, position: pos, bgColor });
24533
+ // keep background image cleared to avoid layering
24534
+ s.backgroundImage = "none";
24535
+ s.backgroundRepeat = "no-repeat";
24536
+ s.backgroundPosition = "center center";
24537
+ s.backgroundSize = "auto";
24538
+ }
24539
+ else if (haveUrl) {
24540
+ // IMAGE path
24541
+ const mode = ((_p = cfg.splashScreenMode) !== null && _p !== void 0 ? _p : "contain");
24542
+ switch (mode) {
24543
+ case "contain":
24544
+ s.backgroundSize = "contain";
24545
+ s.backgroundRepeat = "no-repeat";
24546
+ break;
24547
+ case "cover":
24548
+ s.backgroundSize = "cover";
24549
+ s.backgroundRepeat = "no-repeat";
24550
+ break;
24551
+ case "stretch":
24552
+ s.backgroundSize = "100% 100%";
24553
+ s.backgroundRepeat = "no-repeat";
24554
+ break;
24555
+ case "repeat":
24556
+ s.backgroundSize = "auto";
24557
+ s.backgroundRepeat = "repeat";
24558
+ break;
24513
24559
  }
24514
- else {
24515
- // No image → ensure any previous image is cleared
24516
- s.backgroundImage = "none";
24517
- s.backgroundRepeat = "no-repeat";
24518
- s.backgroundPosition = "center center";
24519
- s.backgroundSize = "auto";
24560
+ s.backgroundPosition = cfg.splashScreenPosition || "center center";
24561
+ s.backgroundImage = `url("${cfg.splashScreenUrl}")`;
24562
+ }
24563
+ else {
24564
+ // COLOR only
24565
+ s.backgroundImage = "none";
24566
+ s.backgroundRepeat = "no-repeat";
24567
+ s.backgroundPosition = "center center";
24568
+ s.backgroundSize = "auto";
24569
+ }
24570
+ }
24571
+ ensureSplashHost() {
24572
+ var _a, _b, _c, _d, _e, _f;
24573
+ const el = (_f = (_a = this.loveLettersContainer) !== null && _a !== void 0 ? _a : (_e = (_d = (_c = (_b = this.webRtcController) === null || _b === void 0 ? void 0 : _b.videoPlayer) === null || _c === void 0 ? void 0 : _c.getVideoParentElement) === null || _d === void 0 ? void 0 : _d.call(_c)) === null || _e === void 0 ? void 0 : _e.parentElement) !== null && _f !== void 0 ? _f : null;
24574
+ if (!el)
24575
+ return null;
24576
+ this._splashHost = el;
24577
+ // ensure stacking works
24578
+ if (getComputedStyle(this._splashHost).position === "static")
24579
+ this._splashHost.style.position = "relative";
24580
+ return this._splashHost;
24581
+ }
24582
+ destroySplashVideo() {
24583
+ if (this._splashVideo) {
24584
+ try {
24585
+ this._splashVideo.pause();
24520
24586
  }
24587
+ catch (_a) { }
24588
+ try {
24589
+ this._splashVideo.remove();
24590
+ }
24591
+ catch (_b) { }
24592
+ this._splashVideo = undefined;
24521
24593
  }
24522
- catch (_r) { }
24594
+ }
24595
+ upsertSplashVideo(url, opts) {
24596
+ var _a, _b;
24597
+ const host = this.ensureSplashHost();
24598
+ if (!host)
24599
+ return;
24600
+ let v = this._splashVideo;
24601
+ if (!v) {
24602
+ v = document.createElement("video");
24603
+ v.playsInline = true;
24604
+ v.setAttribute("webkit-playsinline", "true");
24605
+ v.muted = true; // for autoplay
24606
+ v.autoplay = true;
24607
+ v.loop = true;
24608
+ v.style.position = "absolute";
24609
+ v.style.inset = "0";
24610
+ v.style.width = "100%";
24611
+ v.style.height = "100%";
24612
+ v.style.objectFit = "contain";
24613
+ v.style.objectPosition = "center center";
24614
+ v.style.pointerEvents = "none";
24615
+ v.style.zIndex = "0";
24616
+ host.appendChild(v);
24617
+ this._splashVideo = v;
24618
+ }
24619
+ v.src = url;
24620
+ v.style.objectFit = (_a = opts.fit) !== null && _a !== void 0 ? _a : "contain";
24621
+ v.style.objectPosition = (_b = opts.position) !== null && _b !== void 0 ? _b : "center center";
24622
+ if (opts.bgColor)
24623
+ host.style.setProperty("background-color", opts.bgColor, "important");
24624
+ v.style.display = "";
24625
+ v.play().catch(() => { });
24626
+ }
24627
+ hideSplashVideo() {
24628
+ if (this._splashVideo) {
24629
+ try {
24630
+ this._splashVideo.pause();
24631
+ }
24632
+ catch (_a) { }
24633
+ this._splashVideo.style.display = "none";
24634
+ }
24635
+ }
24636
+ isVideoUrl(u) {
24637
+ if (!u)
24638
+ return false;
24639
+ const s = u.split("?")[0].toLowerCase();
24640
+ return (s.startsWith("blob:") ||
24641
+ s.endsWith(".mp4") ||
24642
+ s.endsWith(".webm") ||
24643
+ s.endsWith(".ogg") ||
24644
+ s.endsWith(".ogv") ||
24645
+ s.endsWith(".m3u8"));
24523
24646
  }
24524
24647
  }
24525
24648