@arcware-cloud/pixelstreaming-websdk 1.3.9 → 1.3.11

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/README.md CHANGED
@@ -80,6 +80,11 @@ For more detailed examples and advanced usage, please refer to our documentation
80
80
 
81
81
  # Changelog
82
82
 
83
+ ### 1.3.11
84
+
85
+ - added orientationZoom field for managing zoom
86
+ - fixed stream-ui issue (occurred on React.js)
87
+
83
88
  ### 1.3.9
84
89
 
85
90
  - added an event handler to check if video is streaming if cloud requests evidence
package/index.cjs.js CHANGED
@@ -23420,7 +23420,7 @@ class ArcwareConfig extends lib_pixelstreamingfrontend_ue5_5_1.Config {
23420
23420
  if (!config.initialSettings.ss)
23421
23421
  config.initialSettings.ss = exports.DefaultUrl;
23422
23422
  super(config);
23423
- this.VERSION = "1.3.9";
23423
+ this.VERSION = "1.3.11";
23424
23424
  this.settings = settings;
23425
23425
  this.session = new Session_1.Session();
23426
23426
  this._initialSettings = config.initialSettings;
@@ -23536,7 +23536,7 @@ function ArcwareInit({ shareId, projectId }, configuration, forceRefresh = false
23536
23536
  useUrlParams: (configuration === null || configuration === void 0 ? void 0 : configuration.useUrlParams) === true,
23537
23537
  initialSettings: Object.assign({ ss: ArcwareConfig_1.DefaultUrl, AutoConnect: false, StartVideoMuted: true, AutoPlayVideo: true, KeyboardInput: true, MouseInput: true, GamepadInput: true, TouchInput: true, XRControllerInput: true, UseMic: true, SuppressBrowserKeys: true, FakeMouseWithTouches: false, ForceMonoAudio: false, HoveringMouse: true }, configuration === null || configuration === void 0 ? void 0 : configuration.initialSettings),
23538
23538
  settings: Object.assign({ shareId,
23539
- projectId, fullscreenButton: true, audioButton: true, stopButton: false, infoButton: false, micButton: false, settingsButton: false, connectionStrengthIcon: false, connectionIdentifierLoggingDisabled: undefined, errorHandler: undefined, loveLetterHandler: undefined, loveLetterLogging: undefined, queueHandler: undefined, sessionIdHandler: undefined, startHeight: undefined, startWidth: undefined }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23539
+ projectId, fullscreenButton: true, audioButton: true, stopButton: false, infoButton: false, micButton: false, settingsButton: false, connectionStrengthIcon: false, connectionIdentifierLoggingDisabled: undefined, errorHandler: undefined, loveLetterHandler: undefined, loveLetterLogging: undefined, queueHandler: undefined, sessionIdHandler: undefined, startHeight: undefined, startWidth: undefined, orientationZoom: undefined }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23540
23540
  });
23541
23541
  const PixelStreaming = new ArcwarePixelStreaming_1.ArcwarePixelStreaming(Config);
23542
23542
  const Application = new ArcwareApplication_1.ArcwareApplication({ stream: PixelStreaming });
@@ -23573,6 +23573,7 @@ const ArcwareLogoLoader_1 = __webpack_require__(6469);
23573
23573
  const MicrophoneOverlay_1 = __webpack_require__(3613);
23574
23574
  const ConnectionIdentifier_1 = __webpack_require__(5999);
23575
23575
  const DiagnosticsCollector_1 = __webpack_require__(8429);
23576
+ const common_1 = __webpack_require__(2483);
23576
23577
  class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStreaming {
23577
23578
  resetInitGuardsAndHooks() {
23578
23579
  this.videoInitializedSent = false;
@@ -24102,15 +24103,16 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24102
24103
  }
24103
24104
  }
24104
24105
  handleResolutionChange() {
24105
- var _a, _b, _c, _d, _e, _f, _g;
24106
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24106
24107
  if (!(this === null || this === void 0 ? void 0 : this.streamInfo) || !(this === null || this === void 0 ? void 0 : this.webRtcController) || !((_b = (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.videoPlayer) === null || _b === void 0 ? void 0 : _b.getVideoElement())) {
24107
24108
  return;
24108
24109
  }
24109
24110
  const resolution = (_d = (_c = this === null || this === void 0 ? void 0 : this.streamInfo) === null || _c === void 0 ? void 0 : _c.streamInfo) === null || _d === void 0 ? void 0 : _d.resolution;
24110
24111
  const unrealVersion = (_g = (_f = (_e = this === null || this === void 0 ? void 0 : this.streamInfo) === null || _e === void 0 ? void 0 : _e.streamInfo) === null || _f === void 0 ? void 0 : _f.meta) === null || _g === void 0 ? void 0 : _g.version;
24112
+ const orientationZoom = (_h = this.config.settings) === null || _h === void 0 ? void 0 : _h.orientationZoom;
24111
24113
  if (resolution && (resolution === null || resolution === void 0 ? void 0 : resolution.dynamic)) {
24112
24114
  setTimeout(() => {
24113
- var _a;
24115
+ var _a, _b, _c;
24114
24116
  const { videoPlayer } = this === null || this === void 0 ? void 0 : this.webRtcController;
24115
24117
  const videoElementParent = videoPlayer === null || videoPlayer === void 0 ? void 0 : videoPlayer.getVideoParentElement();
24116
24118
  const browserWidth = videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.getBoundingClientRect().width;
@@ -24127,10 +24129,32 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24127
24129
  limitedHeight = maxHeight;
24128
24130
  limitedWidth = maxHeight * aspectRatio;
24129
24131
  }
24132
+ // width: clientWidth * Math.max(window.devicePixelRatio, 1) - for retina device, 1 is min upscale factor
24133
+ const newRes = (0, common_1.capScale)({
24134
+ width: browserWidth * Math.max(window.devicePixelRatio, 1.25),
24135
+ height: browserHeight * Math.max(window.devicePixelRatio, 1.25),
24136
+ }, {
24137
+ width: maxWidth,
24138
+ height: maxHeight,
24139
+ });
24140
+ // Zoom level for orientation change if provided
24141
+ if (orientationZoom) {
24142
+ if (newRes.width < newRes.height) {
24143
+ if (orientationZoom.hasOwnProperty('portrait'))
24144
+ (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.emitUIInteraction({
24145
+ zoom: orientationZoom.portrait
24146
+ });
24147
+ }
24148
+ else if (orientationZoom.hasOwnProperty('landscape')) {
24149
+ (_b = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _b === void 0 ? void 0 : _b.emitUIInteraction({
24150
+ zoom: orientationZoom.landscape
24151
+ });
24152
+ }
24153
+ }
24130
24154
  if (videoPlayer) {
24131
24155
  if (!unrealVersion || (unrealVersion === null || unrealVersion === void 0 ? void 0 : unrealVersion.startsWith("4.27"))) {
24132
24156
  const descriptor = { Console: `r.setres ${Math.round(limitedWidth)}x${Math.round(limitedHeight)}w` };
24133
- (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.emitUIInteraction(descriptor);
24157
+ (_c = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _c === void 0 ? void 0 : _c.emitUIInteraction(descriptor);
24134
24158
  }
24135
24159
  else {
24136
24160
  videoPlayer.onMatchViewportResolutionCallback(Math.round(limitedWidth), Math.round(limitedHeight));
@@ -24316,11 +24340,14 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24316
24340
  }
24317
24341
  }
24318
24342
  injectCustomUI() {
24319
- var _a;
24320
- const customUI = document === null || document === void 0 ? void 0 : document.getElementById("stream-ui");
24321
- const videoElementParent = (_a = this === null || this === void 0 ? void 0 : this.videoElementParent) === null || _a === void 0 ? void 0 : _a.parentElement;
24322
- if (customUI && videoElementParent)
24323
- videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.appendChild(customUI);
24343
+ (0, common_1.waitForElement)('#stream-ui')
24344
+ .then(el => {
24345
+ var _a;
24346
+ const videoElementParent = (_a = this === null || this === void 0 ? void 0 : this.videoElementParent) === null || _a === void 0 ? void 0 : _a.parentElement;
24347
+ if (videoElementParent) {
24348
+ videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.appendChild(el);
24349
+ }
24350
+ });
24324
24351
  }
24325
24352
  }
24326
24353
  exports.ArcwarePixelStreaming = ArcwarePixelStreaming;
@@ -24384,7 +24411,12 @@ exports.ArcwareSettingsSchema = zod_1.z.object({
24384
24411
  /** Width with which instance should be started */
24385
24412
  startWidth: zod_1.z.number().optional(),
24386
24413
  /** Height with which instance should be started */
24387
- startHeight: zod_1.z.number().optional()
24414
+ startHeight: zod_1.z.number().optional(),
24415
+ /** Zoom functionality */
24416
+ orientationZoom: zod_1.z.object({
24417
+ landscape: zod_1.z.number(),
24418
+ portrait: zod_1.z.number(),
24419
+ }).strict().optional()
24388
24420
  });
24389
24421
 
24390
24422
 
@@ -25182,7 +25214,7 @@ exports.DiagnosticsCollector = DiagnosticsCollector;
25182
25214
 
25183
25215
 
25184
25216
  Object.defineProperty(exports, "__esModule", ({ value: true }));
25185
- exports.normalizeType = exports.randomHash = exports.extFromMime = exports.sanitizeFilename = exports.truncateByBytes = exports.parseUnknownToObject = void 0;
25217
+ exports.capScale = exports.waitForElement = exports.normalizeType = exports.randomHash = exports.extFromMime = exports.sanitizeFilename = exports.truncateByBytes = exports.parseUnknownToObject = void 0;
25186
25218
  /** Conservative normalizer: accepts object, strict JSON string, or JSON-ish like {foo: "bar"} */
25187
25219
  function parseUnknownToObject(input, opts = { allowJsonish: true }) {
25188
25220
  if (input && typeof input === "object")
@@ -25281,6 +25313,47 @@ function normalizeType(v) {
25281
25313
  return typeof v === "string" ? v.trim().toLowerCase() : "";
25282
25314
  }
25283
25315
  exports.normalizeType = normalizeType;
25316
+ function waitForElement(selector, { root = document, timeout = 3000 } = {}) {
25317
+ return new Promise((resolve) => {
25318
+ const existing = root.querySelector(selector);
25319
+ if (existing)
25320
+ return resolve(existing);
25321
+ const observer = new MutationObserver(() => {
25322
+ const el = root.querySelector(selector);
25323
+ if (el) {
25324
+ clearTimeout(timer);
25325
+ observer.disconnect();
25326
+ resolve(el); // fires once
25327
+ }
25328
+ });
25329
+ observer.observe(root.documentElement || root, { childList: true, subtree: true });
25330
+ const timer = setTimeout(() => {
25331
+ observer.disconnect();
25332
+ }, timeout);
25333
+ });
25334
+ }
25335
+ exports.waitForElement = waitForElement;
25336
+ function capScale(size, max) {
25337
+ const result = { width: 0, height: 0 };
25338
+ /* result.width = size.width > max.width ? max.width : size.width;
25339
+ result.height = size.height > max.height ? max.height : size.height; */
25340
+ result.width = Math.floor(size.width);
25341
+ result.height = Math.floor(size.height);
25342
+ if (result.height > max.height) {
25343
+ const heightScale = max.height / result.height;
25344
+ result.height = max.height;
25345
+ result.width *= heightScale;
25346
+ }
25347
+ if (result.width > max.width) {
25348
+ const heightScale = max.width / result.width;
25349
+ result.width = max.width;
25350
+ result.height *= heightScale;
25351
+ }
25352
+ result.width = (result.width % 2) + result.width;
25353
+ result.height = (result.height % 2) + result.height;
25354
+ return result;
25355
+ }
25356
+ exports.capScale = capScale;
25284
25357
 
25285
25358
 
25286
25359
  /***/ }),
package/index.esm.js CHANGED
@@ -23428,7 +23428,7 @@ class ArcwareConfig extends _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBP
23428
23428
  if (!config.initialSettings.ss)
23429
23429
  config.initialSettings.ss = DefaultUrl;
23430
23430
  super(config);
23431
- this.VERSION = "1.3.9";
23431
+ this.VERSION = "1.3.11";
23432
23432
  this.settings = settings;
23433
23433
  this.session = new _domain_Session__WEBPACK_IMPORTED_MODULE_0__.Session();
23434
23434
  this._initialSettings = config.initialSettings;
@@ -23547,7 +23547,7 @@ function ArcwareInit({ shareId, projectId }, configuration, forceRefresh = false
23547
23547
  useUrlParams: (configuration === null || configuration === void 0 ? void 0 : configuration.useUrlParams) === true,
23548
23548
  initialSettings: Object.assign({ ss: _ArcwareConfig__WEBPACK_IMPORTED_MODULE_0__.DefaultUrl, AutoConnect: false, StartVideoMuted: true, AutoPlayVideo: true, KeyboardInput: true, MouseInput: true, GamepadInput: true, TouchInput: true, XRControllerInput: true, UseMic: true, SuppressBrowserKeys: true, FakeMouseWithTouches: false, ForceMonoAudio: false, HoveringMouse: true }, configuration === null || configuration === void 0 ? void 0 : configuration.initialSettings),
23549
23549
  settings: Object.assign({ shareId,
23550
- projectId, fullscreenButton: true, audioButton: true, stopButton: false, infoButton: false, micButton: false, settingsButton: false, connectionStrengthIcon: false, connectionIdentifierLoggingDisabled: undefined, errorHandler: undefined, loveLetterHandler: undefined, loveLetterLogging: undefined, queueHandler: undefined, sessionIdHandler: undefined, startHeight: undefined, startWidth: undefined }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23550
+ projectId, fullscreenButton: true, audioButton: true, stopButton: false, infoButton: false, micButton: false, settingsButton: false, connectionStrengthIcon: false, connectionIdentifierLoggingDisabled: undefined, errorHandler: undefined, loveLetterHandler: undefined, loveLetterLogging: undefined, queueHandler: undefined, sessionIdHandler: undefined, startHeight: undefined, startWidth: undefined, orientationZoom: undefined }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23551
23551
  });
23552
23552
  const PixelStreaming = new _ArcwarePixelStreaming__WEBPACK_IMPORTED_MODULE_1__.ArcwarePixelStreaming(Config);
23553
23553
  const Application = new _ArcwareApplication__WEBPACK_IMPORTED_MODULE_2__.ArcwareApplication({ stream: PixelStreaming });
@@ -23581,11 +23581,13 @@ __webpack_require__.r(__webpack_exports__);
23581
23581
  /* harmony import */ var _domain_EventHandler__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3379);
23582
23582
  /* harmony import */ var _domain_Stats__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9764);
23583
23583
  /* harmony import */ var _domain_debounce__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9580);
23584
- /* harmony import */ var _ui_LoveLetters__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4572);
23585
- /* harmony import */ var _ui_ArcwareLogoLoader__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6469);
23584
+ /* harmony import */ var _ui_LoveLetters__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4572);
23585
+ /* harmony import */ var _ui_ArcwareLogoLoader__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(6469);
23586
23586
  /* harmony import */ var _ui_MicrophoneOverlay__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3613);
23587
23587
  /* harmony import */ var _domain_ConnectionIdentifier__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5999);
23588
23588
  /* harmony import */ var _features_DiagnosticsCollector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8429);
23589
+ /* harmony import */ var _features_common__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(2483);
23590
+
23589
23591
 
23590
23592
 
23591
23593
 
@@ -24127,15 +24129,16 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24127
24129
  }
24128
24130
  }
24129
24131
  handleResolutionChange() {
24130
- var _a, _b, _c, _d, _e, _f, _g;
24132
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24131
24133
  if (!(this === null || this === void 0 ? void 0 : this.streamInfo) || !(this === null || this === void 0 ? void 0 : this.webRtcController) || !((_b = (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.videoPlayer) === null || _b === void 0 ? void 0 : _b.getVideoElement())) {
24132
24134
  return;
24133
24135
  }
24134
24136
  const resolution = (_d = (_c = this === null || this === void 0 ? void 0 : this.streamInfo) === null || _c === void 0 ? void 0 : _c.streamInfo) === null || _d === void 0 ? void 0 : _d.resolution;
24135
24137
  const unrealVersion = (_g = (_f = (_e = this === null || this === void 0 ? void 0 : this.streamInfo) === null || _e === void 0 ? void 0 : _e.streamInfo) === null || _f === void 0 ? void 0 : _f.meta) === null || _g === void 0 ? void 0 : _g.version;
24138
+ const orientationZoom = (_h = this.config.settings) === null || _h === void 0 ? void 0 : _h.orientationZoom;
24136
24139
  if (resolution && (resolution === null || resolution === void 0 ? void 0 : resolution.dynamic)) {
24137
24140
  setTimeout(() => {
24138
- var _a;
24141
+ var _a, _b, _c;
24139
24142
  const { videoPlayer } = this === null || this === void 0 ? void 0 : this.webRtcController;
24140
24143
  const videoElementParent = videoPlayer === null || videoPlayer === void 0 ? void 0 : videoPlayer.getVideoParentElement();
24141
24144
  const browserWidth = videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.getBoundingClientRect().width;
@@ -24152,10 +24155,32 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24152
24155
  limitedHeight = maxHeight;
24153
24156
  limitedWidth = maxHeight * aspectRatio;
24154
24157
  }
24158
+ // width: clientWidth * Math.max(window.devicePixelRatio, 1) - for retina device, 1 is min upscale factor
24159
+ const newRes = (0,_features_common__WEBPACK_IMPORTED_MODULE_12__.capScale)({
24160
+ width: browserWidth * Math.max(window.devicePixelRatio, 1.25),
24161
+ height: browserHeight * Math.max(window.devicePixelRatio, 1.25),
24162
+ }, {
24163
+ width: maxWidth,
24164
+ height: maxHeight,
24165
+ });
24166
+ // Zoom level for orientation change if provided
24167
+ if (orientationZoom) {
24168
+ if (newRes.width < newRes.height) {
24169
+ if (orientationZoom.hasOwnProperty('portrait'))
24170
+ (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.emitUIInteraction({
24171
+ zoom: orientationZoom.portrait
24172
+ });
24173
+ }
24174
+ else if (orientationZoom.hasOwnProperty('landscape')) {
24175
+ (_b = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _b === void 0 ? void 0 : _b.emitUIInteraction({
24176
+ zoom: orientationZoom.landscape
24177
+ });
24178
+ }
24179
+ }
24155
24180
  if (videoPlayer) {
24156
24181
  if (!unrealVersion || (unrealVersion === null || unrealVersion === void 0 ? void 0 : unrealVersion.startsWith("4.27"))) {
24157
24182
  const descriptor = { Console: `r.setres ${Math.round(limitedWidth)}x${Math.round(limitedHeight)}w` };
24158
- (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.emitUIInteraction(descriptor);
24183
+ (_c = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _c === void 0 ? void 0 : _c.emitUIInteraction(descriptor);
24159
24184
  }
24160
24185
  else {
24161
24186
  videoPlayer.onMatchViewportResolutionCallback(Math.round(limitedWidth), Math.round(limitedHeight));
@@ -24215,7 +24240,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24215
24240
  }
24216
24241
  initLoveLettersContainer() {
24217
24242
  var _a;
24218
- const logoLoader = new _ui_ArcwareLogoLoader__WEBPACK_IMPORTED_MODULE_12__.ArcwareLogoLoader();
24243
+ const logoLoader = new _ui_ArcwareLogoLoader__WEBPACK_IMPORTED_MODULE_13__.ArcwareLogoLoader();
24219
24244
  if (!this.loveLettersContainer) {
24220
24245
  const loveLettersContainer = document === null || document === void 0 ? void 0 : document.createElement("div");
24221
24246
  const { videoPlayer } = this === null || this === void 0 ? void 0 : this.webRtcController;
@@ -24252,7 +24277,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24252
24277
  if (letter !== undefined) {
24253
24278
  const formattedLoveLetter = letter === null || letter === void 0 ? void 0 : letter.replace(/LL: |\.$/g, "");
24254
24279
  (_a = this === null || this === void 0 ? void 0 : this.loveLettersList) === null || _a === void 0 ? void 0 : _a.push(formattedLoveLetter);
24255
- const loveLettersBox = new _ui_LoveLetters__WEBPACK_IMPORTED_MODULE_13__.LoveLetters();
24280
+ const loveLettersBox = new _ui_LoveLetters__WEBPACK_IMPORTED_MODULE_14__.LoveLetters();
24256
24281
  loveLettersBox === null || loveLettersBox === void 0 ? void 0 : loveLettersBox.addLetter(formattedLoveLetter, (_b = this === null || this === void 0 ? void 0 : this.loveLettersList) === null || _b === void 0 ? void 0 : _b.length);
24257
24282
  setTimeout(() => {
24258
24283
  this.processLoveLetterQueue();
@@ -24341,11 +24366,14 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
24341
24366
  }
24342
24367
  }
24343
24368
  injectCustomUI() {
24344
- var _a;
24345
- const customUI = document === null || document === void 0 ? void 0 : document.getElementById("stream-ui");
24346
- const videoElementParent = (_a = this === null || this === void 0 ? void 0 : this.videoElementParent) === null || _a === void 0 ? void 0 : _a.parentElement;
24347
- if (customUI && videoElementParent)
24348
- videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.appendChild(customUI);
24369
+ (0,_features_common__WEBPACK_IMPORTED_MODULE_12__.waitForElement)('#stream-ui')
24370
+ .then(el => {
24371
+ var _a;
24372
+ const videoElementParent = (_a = this === null || this === void 0 ? void 0 : this.videoElementParent) === null || _a === void 0 ? void 0 : _a.parentElement;
24373
+ if (videoElementParent) {
24374
+ videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.appendChild(el);
24375
+ }
24376
+ });
24349
24377
  }
24350
24378
  }
24351
24379
 
@@ -24411,7 +24439,12 @@ const ArcwareSettingsSchema = zod__WEBPACK_IMPORTED_MODULE_1__.z.object({
24411
24439
  /** Width with which instance should be started */
24412
24440
  startWidth: zod__WEBPACK_IMPORTED_MODULE_1__.z.number().optional(),
24413
24441
  /** Height with which instance should be started */
24414
- startHeight: zod__WEBPACK_IMPORTED_MODULE_1__.z.number().optional()
24442
+ startHeight: zod__WEBPACK_IMPORTED_MODULE_1__.z.number().optional(),
24443
+ /** Zoom functionality */
24444
+ orientationZoom: zod__WEBPACK_IMPORTED_MODULE_1__.z.object({
24445
+ landscape: zod__WEBPACK_IMPORTED_MODULE_1__.z.number(),
24446
+ portrait: zod__WEBPACK_IMPORTED_MODULE_1__.z.number(),
24447
+ }).strict().optional()
24415
24448
  });
24416
24449
 
24417
24450
 
@@ -25219,12 +25252,14 @@ class DiagnosticsCollector {
25219
25252
 
25220
25253
  __webpack_require__.r(__webpack_exports__);
25221
25254
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25255
+ /* harmony export */ "capScale": () => (/* binding */ capScale),
25222
25256
  /* harmony export */ "extFromMime": () => (/* binding */ extFromMime),
25223
25257
  /* harmony export */ "normalizeType": () => (/* binding */ normalizeType),
25224
25258
  /* harmony export */ "parseUnknownToObject": () => (/* binding */ parseUnknownToObject),
25225
25259
  /* harmony export */ "randomHash": () => (/* binding */ randomHash),
25226
25260
  /* harmony export */ "sanitizeFilename": () => (/* binding */ sanitizeFilename),
25227
- /* harmony export */ "truncateByBytes": () => (/* binding */ truncateByBytes)
25261
+ /* harmony export */ "truncateByBytes": () => (/* binding */ truncateByBytes),
25262
+ /* harmony export */ "waitForElement": () => (/* binding */ waitForElement)
25228
25263
  /* harmony export */ });
25229
25264
  /** Conservative normalizer: accepts object, strict JSON string, or JSON-ish like {foo: "bar"} */
25230
25265
  function parseUnknownToObject(input, opts = { allowJsonish: true }) {
@@ -25318,6 +25353,45 @@ function randomHash() {
25318
25353
  function normalizeType(v) {
25319
25354
  return typeof v === "string" ? v.trim().toLowerCase() : "";
25320
25355
  }
25356
+ function waitForElement(selector, { root = document, timeout = 3000 } = {}) {
25357
+ return new Promise((resolve) => {
25358
+ const existing = root.querySelector(selector);
25359
+ if (existing)
25360
+ return resolve(existing);
25361
+ const observer = new MutationObserver(() => {
25362
+ const el = root.querySelector(selector);
25363
+ if (el) {
25364
+ clearTimeout(timer);
25365
+ observer.disconnect();
25366
+ resolve(el); // fires once
25367
+ }
25368
+ });
25369
+ observer.observe(root.documentElement || root, { childList: true, subtree: true });
25370
+ const timer = setTimeout(() => {
25371
+ observer.disconnect();
25372
+ }, timeout);
25373
+ });
25374
+ }
25375
+ function capScale(size, max) {
25376
+ const result = { width: 0, height: 0 };
25377
+ /* result.width = size.width > max.width ? max.width : size.width;
25378
+ result.height = size.height > max.height ? max.height : size.height; */
25379
+ result.width = Math.floor(size.width);
25380
+ result.height = Math.floor(size.height);
25381
+ if (result.height > max.height) {
25382
+ const heightScale = max.height / result.height;
25383
+ result.height = max.height;
25384
+ result.width *= heightScale;
25385
+ }
25386
+ if (result.width > max.width) {
25387
+ const heightScale = max.width / result.width;
25388
+ result.width = max.width;
25389
+ result.height *= heightScale;
25390
+ }
25391
+ result.width = (result.width % 2) + result.width;
25392
+ result.height = (result.height % 2) + result.height;
25393
+ return result;
25394
+ }
25321
25395
 
25322
25396
 
25323
25397
  /***/ }),
package/index.umd.js CHANGED
@@ -23430,7 +23430,7 @@ class ArcwareConfig extends lib_pixelstreamingfrontend_ue5_5_1.Config {
23430
23430
  if (!config.initialSettings.ss)
23431
23431
  config.initialSettings.ss = exports.DefaultUrl;
23432
23432
  super(config);
23433
- this.VERSION = "1.3.9";
23433
+ this.VERSION = "1.3.11";
23434
23434
  this.settings = settings;
23435
23435
  this.session = new Session_1.Session();
23436
23436
  this._initialSettings = config.initialSettings;
@@ -23546,7 +23546,7 @@ function ArcwareInit({ shareId, projectId }, configuration, forceRefresh = false
23546
23546
  useUrlParams: (configuration === null || configuration === void 0 ? void 0 : configuration.useUrlParams) === true,
23547
23547
  initialSettings: Object.assign({ ss: ArcwareConfig_1.DefaultUrl, AutoConnect: false, StartVideoMuted: true, AutoPlayVideo: true, KeyboardInput: true, MouseInput: true, GamepadInput: true, TouchInput: true, XRControllerInput: true, UseMic: true, SuppressBrowserKeys: true, FakeMouseWithTouches: false, ForceMonoAudio: false, HoveringMouse: true }, configuration === null || configuration === void 0 ? void 0 : configuration.initialSettings),
23548
23548
  settings: Object.assign({ shareId,
23549
- projectId, fullscreenButton: true, audioButton: true, stopButton: false, infoButton: false, micButton: false, settingsButton: false, connectionStrengthIcon: false, connectionIdentifierLoggingDisabled: undefined, errorHandler: undefined, loveLetterHandler: undefined, loveLetterLogging: undefined, queueHandler: undefined, sessionIdHandler: undefined, startHeight: undefined, startWidth: undefined }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23549
+ projectId, fullscreenButton: true, audioButton: true, stopButton: false, infoButton: false, micButton: false, settingsButton: false, connectionStrengthIcon: false, connectionIdentifierLoggingDisabled: undefined, errorHandler: undefined, loveLetterHandler: undefined, loveLetterLogging: undefined, queueHandler: undefined, sessionIdHandler: undefined, startHeight: undefined, startWidth: undefined, orientationZoom: undefined }, configuration === null || configuration === void 0 ? void 0 : configuration.settings)
23550
23550
  });
23551
23551
  const PixelStreaming = new ArcwarePixelStreaming_1.ArcwarePixelStreaming(Config);
23552
23552
  const Application = new ArcwareApplication_1.ArcwareApplication({ stream: PixelStreaming });
@@ -23583,6 +23583,7 @@ const ArcwareLogoLoader_1 = __webpack_require__(6469);
23583
23583
  const MicrophoneOverlay_1 = __webpack_require__(3613);
23584
23584
  const ConnectionIdentifier_1 = __webpack_require__(5999);
23585
23585
  const DiagnosticsCollector_1 = __webpack_require__(8429);
23586
+ const common_1 = __webpack_require__(2483);
23586
23587
  class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStreaming {
23587
23588
  resetInitGuardsAndHooks() {
23588
23589
  this.videoInitializedSent = false;
@@ -24112,15 +24113,16 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24112
24113
  }
24113
24114
  }
24114
24115
  handleResolutionChange() {
24115
- var _a, _b, _c, _d, _e, _f, _g;
24116
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24116
24117
  if (!(this === null || this === void 0 ? void 0 : this.streamInfo) || !(this === null || this === void 0 ? void 0 : this.webRtcController) || !((_b = (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.videoPlayer) === null || _b === void 0 ? void 0 : _b.getVideoElement())) {
24117
24118
  return;
24118
24119
  }
24119
24120
  const resolution = (_d = (_c = this === null || this === void 0 ? void 0 : this.streamInfo) === null || _c === void 0 ? void 0 : _c.streamInfo) === null || _d === void 0 ? void 0 : _d.resolution;
24120
24121
  const unrealVersion = (_g = (_f = (_e = this === null || this === void 0 ? void 0 : this.streamInfo) === null || _e === void 0 ? void 0 : _e.streamInfo) === null || _f === void 0 ? void 0 : _f.meta) === null || _g === void 0 ? void 0 : _g.version;
24122
+ const orientationZoom = (_h = this.config.settings) === null || _h === void 0 ? void 0 : _h.orientationZoom;
24121
24123
  if (resolution && (resolution === null || resolution === void 0 ? void 0 : resolution.dynamic)) {
24122
24124
  setTimeout(() => {
24123
- var _a;
24125
+ var _a, _b, _c;
24124
24126
  const { videoPlayer } = this === null || this === void 0 ? void 0 : this.webRtcController;
24125
24127
  const videoElementParent = videoPlayer === null || videoPlayer === void 0 ? void 0 : videoPlayer.getVideoParentElement();
24126
24128
  const browserWidth = videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.getBoundingClientRect().width;
@@ -24137,10 +24139,32 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24137
24139
  limitedHeight = maxHeight;
24138
24140
  limitedWidth = maxHeight * aspectRatio;
24139
24141
  }
24142
+ // width: clientWidth * Math.max(window.devicePixelRatio, 1) - for retina device, 1 is min upscale factor
24143
+ const newRes = (0, common_1.capScale)({
24144
+ width: browserWidth * Math.max(window.devicePixelRatio, 1.25),
24145
+ height: browserHeight * Math.max(window.devicePixelRatio, 1.25),
24146
+ }, {
24147
+ width: maxWidth,
24148
+ height: maxHeight,
24149
+ });
24150
+ // Zoom level for orientation change if provided
24151
+ if (orientationZoom) {
24152
+ if (newRes.width < newRes.height) {
24153
+ if (orientationZoom.hasOwnProperty('portrait'))
24154
+ (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.emitUIInteraction({
24155
+ zoom: orientationZoom.portrait
24156
+ });
24157
+ }
24158
+ else if (orientationZoom.hasOwnProperty('landscape')) {
24159
+ (_b = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _b === void 0 ? void 0 : _b.emitUIInteraction({
24160
+ zoom: orientationZoom.landscape
24161
+ });
24162
+ }
24163
+ }
24140
24164
  if (videoPlayer) {
24141
24165
  if (!unrealVersion || (unrealVersion === null || unrealVersion === void 0 ? void 0 : unrealVersion.startsWith("4.27"))) {
24142
24166
  const descriptor = { Console: `r.setres ${Math.round(limitedWidth)}x${Math.round(limitedHeight)}w` };
24143
- (_a = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _a === void 0 ? void 0 : _a.emitUIInteraction(descriptor);
24167
+ (_c = this === null || this === void 0 ? void 0 : this.webRtcController) === null || _c === void 0 ? void 0 : _c.emitUIInteraction(descriptor);
24144
24168
  }
24145
24169
  else {
24146
24170
  videoPlayer.onMatchViewportResolutionCallback(Math.round(limitedWidth), Math.round(limitedHeight));
@@ -24326,11 +24350,14 @@ class ArcwarePixelStreaming extends lib_pixelstreamingfrontend_ue5_5_1.PixelStre
24326
24350
  }
24327
24351
  }
24328
24352
  injectCustomUI() {
24329
- var _a;
24330
- const customUI = document === null || document === void 0 ? void 0 : document.getElementById("stream-ui");
24331
- const videoElementParent = (_a = this === null || this === void 0 ? void 0 : this.videoElementParent) === null || _a === void 0 ? void 0 : _a.parentElement;
24332
- if (customUI && videoElementParent)
24333
- videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.appendChild(customUI);
24353
+ (0, common_1.waitForElement)('#stream-ui')
24354
+ .then(el => {
24355
+ var _a;
24356
+ const videoElementParent = (_a = this === null || this === void 0 ? void 0 : this.videoElementParent) === null || _a === void 0 ? void 0 : _a.parentElement;
24357
+ if (videoElementParent) {
24358
+ videoElementParent === null || videoElementParent === void 0 ? void 0 : videoElementParent.appendChild(el);
24359
+ }
24360
+ });
24334
24361
  }
24335
24362
  }
24336
24363
  exports.ArcwarePixelStreaming = ArcwarePixelStreaming;
@@ -24394,7 +24421,12 @@ exports.ArcwareSettingsSchema = zod_1.z.object({
24394
24421
  /** Width with which instance should be started */
24395
24422
  startWidth: zod_1.z.number().optional(),
24396
24423
  /** Height with which instance should be started */
24397
- startHeight: zod_1.z.number().optional()
24424
+ startHeight: zod_1.z.number().optional(),
24425
+ /** Zoom functionality */
24426
+ orientationZoom: zod_1.z.object({
24427
+ landscape: zod_1.z.number(),
24428
+ portrait: zod_1.z.number(),
24429
+ }).strict().optional()
24398
24430
  });
24399
24431
 
24400
24432
 
@@ -25192,7 +25224,7 @@ exports.DiagnosticsCollector = DiagnosticsCollector;
25192
25224
 
25193
25225
 
25194
25226
  Object.defineProperty(exports, "__esModule", ({ value: true }));
25195
- exports.normalizeType = exports.randomHash = exports.extFromMime = exports.sanitizeFilename = exports.truncateByBytes = exports.parseUnknownToObject = void 0;
25227
+ exports.capScale = exports.waitForElement = exports.normalizeType = exports.randomHash = exports.extFromMime = exports.sanitizeFilename = exports.truncateByBytes = exports.parseUnknownToObject = void 0;
25196
25228
  /** Conservative normalizer: accepts object, strict JSON string, or JSON-ish like {foo: "bar"} */
25197
25229
  function parseUnknownToObject(input, opts = { allowJsonish: true }) {
25198
25230
  if (input && typeof input === "object")
@@ -25291,6 +25323,47 @@ function normalizeType(v) {
25291
25323
  return typeof v === "string" ? v.trim().toLowerCase() : "";
25292
25324
  }
25293
25325
  exports.normalizeType = normalizeType;
25326
+ function waitForElement(selector, { root = document, timeout = 3000 } = {}) {
25327
+ return new Promise((resolve) => {
25328
+ const existing = root.querySelector(selector);
25329
+ if (existing)
25330
+ return resolve(existing);
25331
+ const observer = new MutationObserver(() => {
25332
+ const el = root.querySelector(selector);
25333
+ if (el) {
25334
+ clearTimeout(timer);
25335
+ observer.disconnect();
25336
+ resolve(el); // fires once
25337
+ }
25338
+ });
25339
+ observer.observe(root.documentElement || root, { childList: true, subtree: true });
25340
+ const timer = setTimeout(() => {
25341
+ observer.disconnect();
25342
+ }, timeout);
25343
+ });
25344
+ }
25345
+ exports.waitForElement = waitForElement;
25346
+ function capScale(size, max) {
25347
+ const result = { width: 0, height: 0 };
25348
+ /* result.width = size.width > max.width ? max.width : size.width;
25349
+ result.height = size.height > max.height ? max.height : size.height; */
25350
+ result.width = Math.floor(size.width);
25351
+ result.height = Math.floor(size.height);
25352
+ if (result.height > max.height) {
25353
+ const heightScale = max.height / result.height;
25354
+ result.height = max.height;
25355
+ result.width *= heightScale;
25356
+ }
25357
+ if (result.width > max.width) {
25358
+ const heightScale = max.width / result.width;
25359
+ result.width = max.width;
25360
+ result.height *= heightScale;
25361
+ }
25362
+ result.width = (result.width % 2) + result.width;
25363
+ result.height = (result.height % 2) + result.height;
25364
+ return result;
25365
+ }
25366
+ exports.capScale = capScale;
25294
25367
 
25295
25368
 
25296
25369
  /***/ }),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arcware-cloud/pixelstreaming-websdk",
3
3
  "description": "WebSDK for easy implementation of pixel streaming with Arcware Cloud Services. Heavily based on the '@epicgames-ps' library.",
4
- "version": "1.3.9",
4
+ "version": "1.3.11",
5
5
  "type": "commonjs",
6
6
  "main": "./index.umd.js",
7
7
  "module": "./index.umd.js",
@@ -26,7 +26,7 @@ export declare class ArcwareConfig extends Config {
26
26
  readonly session: Session;
27
27
  readonly settings: Settings;
28
28
  private _initialSettings;
29
- readonly VERSION = "1.3.9";
29
+ readonly VERSION = "1.3.11";
30
30
  constructor(config: ArcwareConfigParams);
31
31
  /** Setup connection string. */
32
32
  get urlFlags(): string;
@@ -123,6 +123,17 @@ export declare const ArcwareSettingsSchema: z.ZodObject<{
123
123
  startWidth: z.ZodOptional<z.ZodNumber>;
124
124
  /** Height with which instance should be started */
125
125
  startHeight: z.ZodOptional<z.ZodNumber>;
126
+ /** Zoom functionality */
127
+ orientationZoom: z.ZodOptional<z.ZodObject<{
128
+ landscape: z.ZodNumber;
129
+ portrait: z.ZodNumber;
130
+ }, "strict", z.ZodTypeAny, {
131
+ landscape?: number;
132
+ portrait?: number;
133
+ }, {
134
+ landscape?: number;
135
+ portrait?: number;
136
+ }>>;
126
137
  }, "strip", z.ZodTypeAny, {
127
138
  session?: string;
128
139
  token?: string;
@@ -164,6 +175,10 @@ export declare const ArcwareSettingsSchema: z.ZodObject<{
164
175
  connectionIdentifierLoggingDisabled?: boolean;
165
176
  startWidth?: number;
166
177
  startHeight?: number;
178
+ orientationZoom?: {
179
+ landscape?: number;
180
+ portrait?: number;
181
+ };
167
182
  }, {
168
183
  session?: string;
169
184
  token?: string;
@@ -205,5 +220,9 @@ export declare const ArcwareSettingsSchema: z.ZodObject<{
205
220
  connectionIdentifierLoggingDisabled?: boolean;
206
221
  startWidth?: number;
207
222
  startHeight?: number;
223
+ orientationZoom?: {
224
+ landscape?: number;
225
+ portrait?: number;
226
+ };
208
227
  }>;
209
228
  export type Settings = z.infer<typeof ArcwareSettingsSchema>;
@@ -1,3 +1,4 @@
1
+ import { Size } from "@arcware-cloud/shared/signalling-communication";
1
2
  /** Conservative normalizer: accepts object, strict JSON string, or JSON-ish like {foo: "bar"} */
2
3
  export declare function parseUnknownToObject(input: unknown, opts?: {
3
4
  allowJsonish?: boolean;
@@ -11,3 +12,8 @@ export declare function extFromMime(mime: string): string;
11
12
  /** Short random fallback */
12
13
  export declare function randomHash(): string;
13
14
  export declare function normalizeType(v: unknown): string;
15
+ export declare function waitForElement(selector: string, { root, timeout }?: {
16
+ root?: Document;
17
+ timeout?: number;
18
+ }): Promise<any>;
19
+ export declare function capScale(size: Size, max: Size): Size;