# Browser login and stream settings

This frontend refresh ships in **Browser Preview 8**, building on Preview 7's
compatible-profile negotiation. The frontend is embedded in the bundled helper;
install the matching browser-enabled Host package, then reload the browser page.

## Sign in

The sign-in card identifies the Host address from the page's actual origin and
asks for a **Maximizer Host streaming account**. The help disclosure explains
where the Host administrator creates accounts and resets passwords. It does not
imply that this browser page provides account creation or password recovery.

Username and password have persistent labels and stable `name`/`autocomplete`
attributes for password managers. Paste and ordinary Enter-to-submit work. The
Show/Hide button is a separate, keyboard-operable action; passwords are remasked
when submitted and cleared on successful sign-in/sign-out. Caps Lock feedback is
shown while editing the password. Credentials and session tokens are not added to
browser storage by this refresh. The form uses POST and the sign-in button stays
disabled until JavaScript and the required browser features are available.

Signing in shows a busy label and prevents duplicate submissions. Errors appear
beside the sign-in controls with an alert role and keyboard focus. After success,
focus moves to the Stream settings heading. Unsupported browsers get an explicit
feature message; users without JavaScript get an explanation rather than an
apparently working form.

## Set up a stream

- **Application:** choose an application returned by the Host. An empty list
  explains how to add an application and disables Start streaming.
- **Picture quality:** resolution, frame rate and bitrate remain immediately
  available, with units and short explanations. The initial choices remain
  1920×1080, 60 FPS and a 15 Mbps target.
- **Bitrate reduction:** remains an explicit, unchecked choice. Its effect on
  visible detail is explained alongside the control. Resolution stays fixed.
- **Advanced settings:** a native expandable section holds video-profile and
  decoder preferences. Automatic compatibility and hardware-preferred automatic
  decoding remain the initial choices. The complete profile ladder and the
  distinction between a preference and an actual backend are explained.
- **Your next stream:** reflects the form's current application, resolution,
  frame rate, bitrate target, video/decoder preferences and congestion choice.
  These are requested settings, not invented throughput or decoder measurements.
  Display output is explicitly 8-bit SDR.

Start streaming retains the existing session request and negotiation flow. Form
choices are disabled during connection setup so they cannot diverge from the
in-flight request. Disconnect/failure restores them, retaining the selected
values. Both the normal start and compatible-stream retry validate the form.
The controller help is shown after sign-in; existing player controls, canvas
handoff, decoder diagnostics and input handling retain their IDs and routes.

## Fullscreen capture and saved preferences (Browser Preview 9)

Browser Preview 9 adds automatic mouse capture in fullscreen and opt-in saved
stream preferences to the Preview 8 interface.

### Fullscreen and mouse control

The player's **Fullscreen** button requests mouse capture and fullscreen from the
same click. Pointer lock is requested first because fullscreen consumes transient
user activation. The combined request uses standard relative mouse movement so
an unsupported raw-input option cannot consume the opportunity to capture. A
separate Capture mouse action or a recapture click still prefers raw movement,
with ordinary pointer lock as the supported fallback.

The fullscreen element is now a stage containing the video and local controls.
When capture is released or denied, **Capture mouse**, **Exit fullscreen** and
**Disconnect** remain available inside fullscreen. Clicking the video recaptures
the mouse; that first click is consumed locally rather than clicking the remote
desktop or firing in a game. Windowed desktop input continues to use the normal
absolute pointer until Capture mouse is selected.

| Shortcut | Action |
| --- | --- |
| Ctrl+Alt+Shift+M | Capture or release the mouse |
| Ctrl+Alt+Shift+F | Enter or leave player fullscreen |
| Ctrl+Alt+Shift+Q | Disconnect |

Where keyboard lock is supported and allowed, a short Escape can reach the game;
hold Escape to use the browser's fullscreen/capture exit gesture. Without keyboard
lock, Escape may release capture or exit fullscreen immediately. Keyboard lock is
optional: denying it does not prevent fullscreen or mouse capture. Browser F11
fullscreen is separate from the player's Fullscreen action.

Mode changes reset held keys/buttons and pending mouse work. Exiting fullscreen,
disconnecting or replacing a stream retires its owned capture. No mode-change or
focus event automatically recaptures after the user releases the mouse. Late
grants from a retired session are closed without applying that session's intent
to a new canvas. Capture failures are reported inside the fullscreen stage.

References: [MDN requestPointerLock](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestPointerLock)
and [MDN requestFullscreen](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen),
reviewed 2026-10-28. Both Promise and event-only pointer-lock implementations are
handled; the browser's permission and user-activation requirements still apply.

### Remember stream settings

Enable **Remember settings on this browser** to save the current resolution,
frame rate, bitrate target, video-profile preference, decoder preference and
congestion-reduction choice. Subsequent valid edits save automatically. Saved
choices restore when the page is opened again, including after a browser restart.
They are shared by streaming accounts using this browser profile and Host origin
(scheme, address and port); another browser/device or Host origin has its own data.

**Forget saved settings**, or unchecking Remember, deletes only this feature's
record. The current selections remain usable for the current visit. Clearing the
record in another tab also turns off automatic saving here. Another tab's saved
values never change an active stream or overwrite the current form.

The versioned local-storage record contains only the six allowlisted preferences.
It contains no username, password, authentication token, session ticket or app ID.
Restoring preferences does not sign in, start a stream or enter fullscreen. No data
is stored until Remember is selected. Browser private mode or cleared site data
can remove saved preferences.

Validation rejects unknown versions, malformed/oversized records, unsupported
options and invalid numeric values without silently clamping them. An invalid
edit retains the previous valid saved choices and displays an unsaved message.
Storage access, quota, write/readback and deletion failures produce visible
feedback while leaving ordinary sign-in and streaming available.

## Playback guide and Sunshine Stereo (Browser Preview 10)

The settings page puts common choices first: application, picture quality, saved
preferences, then optional advanced settings. On desktop, **Your next stream**
stays visible while the form scrolls. A visible **Fullscreen & playback controls**
panel lists the three shortcuts and explains automatic capture, release/recapture,
and holding Escape when keyboard lock is active. The panel is not hidden behind a
tooltip or an expandable section.

The summary includes **Audio capture: Sunshine Stereo**. The decoder details report
the same source from the session's ready metadata. Browser sessions now disable
Host playback and use the virtual Sunshine Stereo capture path instead of the HDMI
sink selected by the earlier Host-playback flag. This matches the native client's
usual capture path without introducing a separate browser audio format.

These changes ship in **Browser Preview 10**. Install the matching browser-enabled
Host package and reload the browser page.

The development source passes 96 JavaScript checks, the C++ browser protocol
checks, 13 Chrome 156 UI scenarios and eight axe audits with zero violations or
incomplete checks. Desktop, narrow, advanced and forced-colors screenshots were
reviewed. The matching candidate Host also passed the Sunshine Stereo sink,
monitor, audio/reconnect and restoration checks described in `browser-audio.md`.
This remains controlled verification, not a published-package or broad-platform
qualification.

## Design and accessibility approach

The layout uses the Maximizer navy/mint palette, system fonts and local assets.
Desktop sign-in has a compact explanatory panel beside the form; narrow layouts
prioritize the form. Settings use grouped fields and a summary beside them, then
reflow into one column. Advanced options are disclosed on demand; essential
quality choices and the Start streaming action remain directly discoverable.

Controls have visible focus outlines, native semantics and explicit labels/help
associations. Related inputs use `fieldset`/`legend`. Main controls and disclosure
targets are at least 44 CSS pixels high; the checkbox has a large associated label.
Status/error text conveys state independently of color. The page supports reduced
motion, forced colors, text resizing and narrow-width reflow. There are no
third-party fonts, runtime scripts, tracking pixels or UI framework dependencies.

These choices are informed by the following guidance, checked online on
2026-10-28 UTC:

1. [web.dev: Sign-in form best practices](https://web.dev/articles/sign-in-form-best-practices)
   — native forms, stable autofill attributes, visible labels, password visibility,
   clear submission feedback and usable mobile targets.
2. [W3C WAI: Forms tutorial](https://www.w3.org/WAI/tutorials/forms/)
   — concise forms, labelled controls, field grouping and useful instructions.
3. [W3C WAI: User notifications](https://www.w3.org/WAI/tutorials/forms/notifications/)
   — understandable errors, nearby feedback, live regions and focus management.
4. [WCAG 2.2: Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html)
   — the AA minimum is 24×24 CSS pixels or its specified exceptions; the design
   aims above that minimum with 44–48 pixel primary targets.
5. [GOV.UK Design System: Details](https://design-system.service.gov.uk/components/details/)
   — reveal secondary information on demand without hiding essential form fields.

Following these patterns and automated audits is not a claim of complete WCAG
conformance or physical-device/screen-reader certification.

## Verification

`browser/tests/ui-smoke.mjs` serves the actual frontend under the helper's Content
Security Policy. It uses Playwright and axe-core with synthetic API responses and
media boundaries. It never authenticates to a live Host or opens a real stream.
Run it in the designated isolated runtime environment with:

- `PLAYWRIGHT_MODULE`: absolute path to Playwright's `index.mjs`;
- `CHROME_EXECUTABLE`: the test browser executable;
- `AXE_SCRIPT`: a verified local axe-core script;
- `BROWSER_WEB_ROOT`: the `browser/web` directory;
- `UI_OUTPUT_DIR`: a fresh writable results directory.

```sh
node browser/tests/ui-smoke.mjs
```

The suite covers keyboard/Enter/password visibility, required fields, busy and
error feedback, unsupported/no-JavaScript cases, empty/long application names,
summary/request correspondence, pending-field locking, reconnect preservation,
validation on both start routes and logout during a pending start. Layout checks
span 320–3840 CSS pixels, 200% text and forced colors, with screenshots and axe
WCAG 2 A/AA, 2.1 AA, 2.2 AA and best-practice checks. The existing Node test suite
separately covers media/profile/input/audio logic. Physical playback and native
platform qualification remain separate from this frontend fixture.

`browser/tests/preferences.test.js` and `player-controls.test.js` cover storage
failure/validation/allowlisting and asynchronous mode ownership, denial, fallback,
escape and stale-grant behavior. `ui-smoke.mjs` also exercises opt-in/reload,
cross-tab removal, invalid storage and unavailable storage through the real forms.

`browser/tests/session-ui.mjs` requires a private native X11 display/window manager,
`CHROME_PROFILE`, and the same browser/module/web/output variables. It launches
Chrome directly and attaches CDP with `noDefaults`; it does not emulate a viewport
or substitute DOM state for native fullscreen. Native window-manager state,
window dimensions, actual pointer lock, relative input, release/recapture,
disconnect/reconnect, long Escape and a complete browser restart are checked.
Its authentication/media are synthetic, permissions are explicitly granted, and
one capture-denial case is injected at the API boundary. Do not treat that injected
case as acceptance of every browser's physical permission prompt.
