Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Frontend/Docs/Settings Panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ This page will be updated with new features and commands as they become availabl
| **Setting** | **Description** |
| --- | --- |
| **Match viewport resolution** | Resizes the Unreal Engine application resolution to match the browser's video element size.|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Match viewport resolution** | Resizes the Unreal Engine application resolution to match the browser's video element size.|
| **Match Viewport Resolution** | Resizes the Unreal Engine application resolution to match the browser's video element size. (Note: We recommend using `-windowed` on the UE side to allow scaling beyond monitor size.)|

| **Viewport Resolution Scale** | Scale factor for viewport resolution when Match Viewport Resolution is enabled. Range: 0.1-10.0, Default: 1.0. Values above 1.0 (e.g., 1.5, 2.0) can improve visual quality on small screens by requesting higher resolution streams. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Viewport Resolution Scale** | Scale factor for viewport resolution when Match Viewport Resolution is enabled. Range: 0.1-10.0, Default: 1.0. Values above 1.0 (e.g., 1.5, 2.0) can improve visual quality on small screens by requesting higher resolution streams. |
| **Viewport Resolution Scale** | Scale factor for viewport resolution when Match Viewport Resolution is enabled. Range: 0.1-3.0, Default: 1.0 (no scaling). Values above 1.0 (e.g., 1.5, 2.0) can improve visual quality on small screens by requesting higher resolution streams. |

| **Control scheme** | If the scheme is `locked mouse` the browser will use `pointerlock` to capture your mouse, whereas if the scheme is `hovering mouse` you will retain your OS/browser cursor. |
| **Color scheme** | Allows you to switch between light mode and dark mode. |

Expand Down
17 changes: 17 additions & 0 deletions Frontend/library/src/Config/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class NumericParameters {
static MaxReconnectAttempts = 'MaxReconnectAttempts' as const;
static StreamerAutoJoinInterval = 'StreamerAutoJoinInterval' as const;
static KeepaliveDelay = 'KeepaliveDelay' as const;
static ViewportResolutionScale = 'ViewportResScale' as const;
}

export type NumericParametersKeys = Exclude<keyof typeof NumericParameters, 'prototype'>;
Expand Down Expand Up @@ -821,6 +822,22 @@ export class Config {
useUrlParams
)
);

this.numericParameters.set(
NumericParameters.ViewportResolutionScale,
new SettingNumber(
NumericParameters.ViewportResolutionScale,
'Viewport Resolution Scale',
'Scale factor for viewport resolution when MatchViewportResolution is enabled. 1.0 = 100%, 0.5 = 50%, 2.0 = 200%.',
0.1 /*min*/,
10.0 /*max*/,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did some QA on this and we think 3x is a sane maximum. Values above that will commonly cause the encoder to fail as this will exceed the maximum encoding size on our H.264 settings - e.g. 4096x4096.

Suggested change
10.0 /*max*/,
3.0 /*max*/,

settings &&
Object.prototype.hasOwnProperty.call(settings, NumericParameters.ViewportResolutionScale)
? settings[NumericParameters.ViewportResolutionScale]
: 1.0 /*value*/,
useUrlParams
)
);
}

/**
Expand Down
10 changes: 7 additions & 3 deletions Frontend/library/src/VideoPlayer/VideoPlayer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Epic Games, Inc. All Rights Reserved.

import { Config, Flags } from '../Config/Config';
import { Config, Flags, NumericParameters } from '../Config/Config';
import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.7';

/**
Expand Down Expand Up @@ -222,9 +222,13 @@ export class VideoPlayer {
return;
}

const viewportResolutionScale = this.config.getNumericSettingValue(
NumericParameters.ViewportResolutionScale
);

this.onMatchViewportResolutionCallback(
videoElementParent.clientWidth,
videoElementParent.clientHeight
videoElementParent.clientWidth * viewportResolutionScale,
videoElementParent.clientHeight * viewportResolutionScale
);

this.lastTimeResized = new Date().getTime();
Expand Down
Loading