Skip to content

fix(featured-stream): keep the Twitch embed at its 400x300 minimum - #4696

Merged
evanpelle merged 1 commit into
openfrontio:mainfrom
Zixer1:feat/featured-stream-min-size
Jul 23, 2026
Merged

fix(featured-stream): keep the Twitch embed at its 400x300 minimum#4696
evanpelle merged 1 commit into
openfrontio:mainfrom
Zixer1:feat/featured-stream-min-size

Conversation

@Zixer1

@Zixer1 Zixer1 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

Keep the featured-stream Twitch embed at Twitch's documented 400×300 minimum in every state.

Why

Twitch's embed docs state a minimum player size of 400px wide × 300px tall, and that "minimum size requirements and visibility are necessary for autoplay to begin." Below it, autoplay is blocked (this is the requirement not met console message some of us saw).

The panel was under the minimum:

  • Minimized was 360px wide → ~203px tall at 16:9. Under on both axes.
  • Expanded used a 16:9 player, which only reaches 300px tall at ~534px wide, so on narrower viewports it dropped below 300px tall.

Fix

  • Floor the card width at 400px in both minimized and expanded states.
  • Give the player mount a min-h-[300px], so the 16:9 region never falls below 300px tall (it letterboxes between 400 and ~534px wide).

Net: the embed is ≥400×300 wherever autoplay applies (desktop). max-w-[92vw] still guards against horizontal overflow on very narrow screens; Twitch disables autoplay on mobile regardless, so the size floor there is moot.

Twitch ToS audit (while I was in here)

Checked the embed against Twitch's full embedding requirements. Everything else already complies:

Requirement Status
Min size 400×300 fixed here
Player not obscured/hidden while playing ✅ (high z-index; paused + unmounted while in a game; only a transient muted opacity-0 during liveness detection)
Domain uses SSL ✅ (HTTPS)
parent parameter set
Only approved, unmodified player ✅ (no overlay on the video)
Autoplay is muted ✅ (muted: true)
Ads not blocked/obscured ✅ (we only ever pause the whole player)

Tests

No behavior change beyond sizing; existing FeaturedStream tests pass. Verified locally: prettier, eslint, tsc, tests all green.

Follow-up to #4335.

Twitch's documented embed minimum is 400x300, and below it autoplay is
blocked (the "requirement not met" console message). The panel was under
that: minimized was 360px wide (~203px tall at 16:9), and the expanded
16:9 player dropped below 300px tall on narrower viewports.

Floor the width at 400px in both states and give the player mount a 300px
min-height, so the embed stays >=400x300 wherever autoplay applies.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9bb39b43-aedb-4fc8-b38a-127a19178613

📥 Commits

Reviewing files that changed from the base of the PR and between 741ab0f and 630e8cc.

📒 Files selected for processing (1)
  • src/client/FeaturedStream.ts

Walkthrough

FeaturedStream now requires a minimum 400px card width and 300px Twitch mount height, with inline comments updated to describe the embed requirement.

Changes

Featured stream sizing

Layer / File(s) Summary
Twitch embed size constraints
src/client/FeaturedStream.ts
The card width floor and clamp() minimum are increased to 400px, the Twitch mount adds a 300px minimum height, and the sizing comment is updated.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A wider card, a taller view,
Twitch gets room for pixels too.
Four hundred wide, three hundred high,
Clean embed sizing reaches the sky.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: enforcing Twitch's 400x300 minimum for the featured-stream embed.
Description check ✅ Passed The description is directly about the same embed sizing fix and explains the reason and effect of the change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@evanpelle
evanpelle merged commit 462630a into openfrontio:main Jul 23, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Jul 23, 2026
evanpelle pushed a commit that referenced this pull request Jul 24, 2026
… lobby wait (#4698)

Three related changes to the homepage featured-stream panel.

## 1. Exclude the embed off the open web (ToS)
Never mount the Twitch embed on **CrazyGames** or the **desktop (Steam)
shell**, and never load the Twitch SDK there. Matches how the app
already suppresses its own promos off-web via `window.adsEnabled`:

- **CrazyGames:** [only SDK-served ads are
allowed](https://docs.crazygames.com/requirements/ads/) and no external
cross-promotion; a Twitch embed serves Twitch's own ads and is
third-party content.
- **Steam:** Steam [does not support advertising models in
games](https://partner.steamgames.com/doc/marketing/advertising); a live
Twitch player carries Twitch ad breaks, and the desktop shell can't
satisfy Twitch's `parent`-domain requirement.

## 2. Close button for ad-free users
Ad-free users (any shop purchase makes a user `adfree` for life, which
zeroes `window.adsEnabled`) get an `×` in the minimized bar. The close
is remembered **for the current day** (the day is stored in
`localStorage`), so the panel stays gone across reloads that day and
resets for the next day's stream. Ad-supported users keep minimize only;
their mobile flick stays session-only. The minimized state is scoped to
the day the same way.

## 3. Keep the panel through the lobby wait
The panel used to hide the moment you joined a lobby (`join-lobby`). Now
it stays up through the **queue/lobby wait** and hides only once the
game actually starts. `Main.ts` dispatches a new `game-starting` event
at `prestart` (the real start moment); the panel hides on that instead
of on `join-lobby`, and reappears on `leave-lobby`.

> Heads-up for maintainers: (1) and (2) couple this OFM widget to OF's
own ad/entitlement signals (`crazyGamesSDK.isOnCrazyGames()`,
`isDesktopShell()`, `window.adsEnabled`); (3) adds a small shared
`game-starting` document event in `Main.ts`. Flagging in case you'd
rather gate/signal differently.

## Tests
Verified locally: prettier, eslint, tsc, tests all green. Reuses the
existing `common.close` i18n key (no locale-file changes).

Follow-up to #4335 / #4673. Sizing (Twitch's 400×300 minimum) landed in
#4696.
evanpelle pushed a commit that referenced this pull request Jul 25, 2026
…4696)

## What

Keep the featured-stream Twitch embed at Twitch's documented **400×300**
minimum in every state.

## Why

Twitch's embed docs state a minimum player size of **400px wide × 300px
tall**, and that *"minimum size requirements and visibility are
necessary for autoplay to begin."* Below it, autoplay is blocked (this
is the `requirement not met` console message some of us saw).

The panel was under the minimum:
- **Minimized** was `360px` wide → ~203px tall at 16:9. Under on both
axes.
- **Expanded** used a 16:9 player, which only reaches 300px tall at
~534px wide, so on narrower viewports it dropped below 300px tall.

## Fix

- Floor the card width at **400px** in both minimized and expanded
states.
- Give the player mount a **`min-h-[300px]`**, so the 16:9 region never
falls below 300px tall (it letterboxes between 400 and ~534px wide).

Net: the embed is `≥400×300` wherever autoplay applies (desktop).
`max-w-[92vw]` still guards against horizontal overflow on very narrow
screens; Twitch disables autoplay on mobile regardless, so the size
floor there is moot.

## Twitch ToS audit (while I was in here)

Checked the embed against Twitch's full [embedding
requirements](https://dev.twitch.tv/docs/embed/). Everything else
already complies:

| Requirement | Status |
|---|---|
| Min size 400×300 | **fixed here** |
| Player not obscured/hidden while playing | ✅ (high z-index; paused +
unmounted while in a game; only a transient muted `opacity-0` during
liveness detection) |
| Domain uses SSL | ✅ (HTTPS) |
| `parent` parameter set | ✅ |
| Only approved, unmodified player | ✅ (no overlay on the video) |
| Autoplay is muted | ✅ (`muted: true`) |
| Ads not blocked/obscured | ✅ (we only ever pause the whole player) |

## Tests

No behavior change beyond sizing; existing FeaturedStream tests pass.
Verified locally: prettier, eslint, tsc, tests all green.

Follow-up to #4335.
evanpelle pushed a commit that referenced this pull request Jul 25, 2026
… lobby wait (#4698)

Three related changes to the homepage featured-stream panel.

## 1. Exclude the embed off the open web (ToS)
Never mount the Twitch embed on **CrazyGames** or the **desktop (Steam)
shell**, and never load the Twitch SDK there. Matches how the app
already suppresses its own promos off-web via `window.adsEnabled`:

- **CrazyGames:** [only SDK-served ads are
allowed](https://docs.crazygames.com/requirements/ads/) and no external
cross-promotion; a Twitch embed serves Twitch's own ads and is
third-party content.
- **Steam:** Steam [does not support advertising models in
games](https://partner.steamgames.com/doc/marketing/advertising); a live
Twitch player carries Twitch ad breaks, and the desktop shell can't
satisfy Twitch's `parent`-domain requirement.

## 2. Close button for ad-free users
Ad-free users (any shop purchase makes a user `adfree` for life, which
zeroes `window.adsEnabled`) get an `×` in the minimized bar. The close
is remembered **for the current day** (the day is stored in
`localStorage`), so the panel stays gone across reloads that day and
resets for the next day's stream. Ad-supported users keep minimize only;
their mobile flick stays session-only. The minimized state is scoped to
the day the same way.

## 3. Keep the panel through the lobby wait
The panel used to hide the moment you joined a lobby (`join-lobby`). Now
it stays up through the **queue/lobby wait** and hides only once the
game actually starts. `Main.ts` dispatches a new `game-starting` event
at `prestart` (the real start moment); the panel hides on that instead
of on `join-lobby`, and reappears on `leave-lobby`.

> Heads-up for maintainers: (1) and (2) couple this OFM widget to OF's
own ad/entitlement signals (`crazyGamesSDK.isOnCrazyGames()`,
`isDesktopShell()`, `window.adsEnabled`); (3) adds a small shared
`game-starting` document event in `Main.ts`. Flagging in case you'd
rather gate/signal differently.

## Tests
Verified locally: prettier, eslint, tsc, tests all green. Reuses the
existing `common.close` i18n key (no locale-file changes).

Follow-up to #4335 / #4673. Sizing (Twitch's 400×300 minimum) landed in
#4696.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

2 participants