fix: respect autoplay trailers setting and stop preloading trailers#2397
fix: respect autoplay trailers setting and stop preloading trailers#2397Moyasee wants to merge 2 commits into
Conversation
When "Automatically start playing trailers" is disabled, trailers no longer preload on the game page. They stay paused on the poster until the user starts them, both in the desktop gallery and in Big Picture. - gate HLS attach/load behind a load flag in useHlsVideo so segments are only fetched when a trailer is actually started - desktop: add a play overlay that lazily attaches and plays the trailer on click - big picture: read the user preference, defer load, add a play overlay, and let the A button toggle play/pause - big picture: drive the overlay from the video play/pause events and skip our toggle when the click lands on the video so mouse clicks no longer double-toggle - big picture: only show native controls once the trailer is loaded to avoid the stunted control bar
Greptile SummaryThis PR fixes the "autoplay trailers" setting being ignored in both the desktop gallery slider and the Big Picture carousel — trailers were preloading on page open regardless of the preference. The fix defers HLS attachment and segment fetching behind a
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to deferring HLS attachment and segment fetching behind a user-preference flag, with no modifications to download, launch, or settings persistence paths. The core No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Game Page Opens] --> B{autoplayEnabled?}
B -- Yes --> C[load=true\nautoplay=true for first video]
B -- No --> D[load=false\nshowOverlay=true\npreload=none]
C --> E[useHlsVideo attaches HLS\nfetches segments]
D --> F[Poster shown\nPlay overlay visible]
F --> G[User clicks Play]
G --> H{HLS video?}
H -- Yes --> I[setStarted=true\nRe-render: load=true, autoplay=true]
I --> J[useHlsVideo creates HLS\nMANIFEST_PARSED plays]
H -- No --> K[setStarted=true\nvideoRef.play called directly]
J --> L[onPlay fires\nplayingIndex=index\noverlay hidden]
K --> L
L --> M{User pauses?}
M -- Yes --> N[onPause fires\nplayingIndex=null\noverlay reappears + native controls visible]
M -- No --> O[Video continues playing]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Game Page Opens] --> B{autoplayEnabled?}
B -- Yes --> C[load=true\nautoplay=true for first video]
B -- No --> D[load=false\nshowOverlay=true\npreload=none]
C --> E[useHlsVideo attaches HLS\nfetches segments]
D --> F[Poster shown\nPlay overlay visible]
F --> G[User clicks Play]
G --> H{HLS video?}
H -- Yes --> I[setStarted=true\nRe-render: load=true, autoplay=true]
I --> J[useHlsVideo creates HLS\nMANIFEST_PARSED plays]
H -- No --> K[setStarted=true\nvideoRef.play called directly]
J --> L[onPlay fires\nplayingIndex=index\noverlay hidden]
K --> L
L --> M{User pauses?}
M -- Yes --> N[onPause fires\nplayingIndex=null\noverlay reappears + native controls visible]
M -- No --> O[Video continues playing]
Reviews (2): Last reviewed commit: "fix: address greptile review on trailer ..." | Re-trigger Greptile |
- reset desktop VideoPlayer started state when loadOnDemand changes so toggling the setting while the game page stays mounted does not leave the video empty - only show the big picture play overlay once preferences have loaded to avoid a brief overlay flash for users who have autoplay enabled - extract the play icon sizes into named constants
|
@greptile review |
|



When submitting this pull request, I confirm the following (please check the boxes):
Fill in the PR content:
Closes LBX-806.
With "Automatically start playing trailers on the game page" disabled, Hydra was still loading every trailer at once on page open (paused). They now stay on the poster and only load once the user starts them.
What changed:
useHlsVideogets aloadflag, so HLS only attaches and fetches segments when a trailer is actually started.Tested on the desktop game page and in Big Picture with the setting both on and off, using mouse and gamepad.