Skip to content

[mobileWallLayout] scrollFeed 3.7: scene wall, stall recovery, decoder release - #823

Merged
DogmaDragon merged 2 commits into
stashapp:mainfrom
speckofthecosmos:mobilewalllayout-3.7
Dec 4, 2026
Merged

DogmaDragon merged 2 commits into
stashapp:mainfrom
speckofthecosmos:mobilewalllayout-3.7

Conversation

@speckofthecosmos

Copy link
Copy Markdown
Contributor

Brought my private scrollFeed changes up to date here: the scenes wall now works as a feed too, clips far off screen are unloaded so the phone doesn't run hot, and a few Safari stalls are fixed.

Claude Opus 5.5 (high)

Updates plugins/mobileWallLayout (display name scrollFeed) from 3.0 to 3.7. Follows #680, #692 and #704. Plugin ID, file names and the forum url: are unchanged, so existing installs upgrade in place.

Behavior (what changes for users)

  • Scene wall. Play-on-visibility, ordered loading and the single-column touch layout now also apply on /scenes in wall view. Grid and list views have no wall videos and are unaffected. On Stash v0.32.0 and later, scene wall videos exist only when wall playback is set to "video".
  • Far-off clips are unloaded. Clips more than five screens away are paused and their source removed, which frees the decoder and buffer. They queue for loading again when they come within two screens. The gap between the two distances stops clips at the edge from being refetched on every small scroll.
  • No self-starting clips. The autoplay attribute is removed from wall videos, so a clip whose source is restored off screen no longer starts playing on its own. Only the visibility observer starts playback.
  • Clips that become playable while in view start playing. Before, a clip that missed the visibility edge and the queue's one-shot canplay stayed paused until scrolled out and back.
  • Stall recovery. In the author's testing, Safari (iOS 27 and macOS) freezes Stash's VP9/WebM image-clip previews on their last frame instead of looping, with no ended event; Chrome loops the same files. A 500 ms check restarts an in-view looping clip that sits at its end without moving.
  • AV1 fallback for image clips. In the author's diagnosis, Safari's AV1 decoder can stop working mid-session until Safari restarts, while VP9 and H.264 keep working. When a video whose source is /image/<id>/image fails with a decode error, the plugin swaps in /image/<id>/preview at the full file's on-screen size. It swaps only when the preview exists, restores the full file if the preview fails too, and leaves off-screen lightbox slides paused.
  • Fewer refetch stalls. Clips within two screens keep the source React gave them when the wall renders; only clips further away go through the ordered queue. This shortens the pause when Stash refetches the list (adding a tag, changing a filter). On the author's phone, changes on a markers wall of 20 per page now run without a stall.

Implementation notes (open to revision)

  • Two extra IntersectionObservers with rootMargin of _NEAR_SCREENS (2) and _FAR_SCREENS (5) viewport heights: load and release. The near observer is created before the play observer so a clip is queued before the play pass tries to move it to the head of the queue.
  • At registration, near versus far is decided synchronously with getBoundingClientRect() against _NEAR_SCREENS × innerHeight, so near clips are never stripped and restored.
  • The iOS decoder-eviction re-load() now skips clips whose fetch is still running (networkState is NETWORK_LOADING).
  • The stall check is a setInterval that runs only while a target page is open and is cleared on navigation away.
  • The AV1 fallback is one capture-phase error listener on document, because media error events do not bubble. It checks the preview with a one-byte range request before swapping. It sets the element's width and height to the full file's pixel size, because Stash's lightbox scales the slide from the full file's dimensions. It is not limited to the walls or to touch devices, since the lightbox and image page render the full file. It could be split into its own plugin if preferred.
  • In current Stash the scene wall is SceneWallPanel (react-photo-gallery), so the existing .wall-item layout rules cover it. The CSS also carries rules for the older .wall markup (.wall-item-container, .wall-item-anchor, the 450px / 253px caps); on current Stash these match nothing on the three target pages and could be dropped.
  • The layout CSS stays behind @media (pointer: coarse). The video behaviour is not gated by device, as in 3.0.
  • README updated: target pages, the new behaviours, the tuning constants, retention, and a short 3.1 to 3.7 change list.

Testing

  • node --check plugins/mobileWallLayout/mobileWallLayout.js passes.
  • node ./validate.js --ci passes ("Validation passed!").
  • There is no automated test suite for this plugin.
  • A throwaway Stash (stashapp/stash:development, v0.32.0-12) in Docker with synthetic ffmpeg clips: 40 scenes, 40 markers, 13 image clips (3 AV1, one corrupted so it fails to decode). Driven with Playwright's headless Chromium at phone size (390×844, touch, pointer: coarse) and desktop size (1440×900), with and without a 1.5 Mbps / 150 ms network throttle, on the Scenes, Markers and Images walls and the lightbox. Measured per video readyState, networkState, paused, preload and autoplay, plus video request counts and concurrency. The scene wall's 20 to 60 per page switch was also run in Playwright's WebKit at phone size.
  • An LLM code review was run over the plugin. Its findings and what was done with each are below and under Limits.
  • Fixed after the review, each checked before and after in the browser above:
    • The decoder-eviction load() restarted the fetch of every in-view clip that was still loading at first render (up to 13 restarts per wall). Now none. On the throttled desktop markers wall, three in-view clips were still blank after 12 s before the fix; none after.
    • A clip unloaded while its queued load was in flight and scrolled straight back stayed blank (throttled phone). Now it loads and plays.
    • A clip released, given a new src by React, then released again was restored with its old src. Now the current one.
    • AV1 fallback: in the lightbox the preview drew at half size, and on the phone mostly off screen (195×110 at x = -222 instead of 390×219 at x = 0); now it fills the slot. A forced decode error on an off-screen neighbour slide started it playing; now it stays paused. With the preview missing, the slide was left on a 404 preview; now it keeps its original source. A preview that fails after the swap restores the original source once, with no loop.
    • Smaller: the two margins now come from one number each; a missing null guard; a redundant line; a no-op call; outdated comments.
  • The author has used versions 3.1 to 3.7 on their own phone since October 2026, according to the author's notes, and ran this PR build on an iPhone (iOS 27 Safari) against their own library before it was opened.
  • Found on the iPhone and fixed: after switching the scene wall from 20 to 60 per page, the clips just below the first screen stayed blank until scrolled far away and back. A per-card readout of load state showed them in view, paused, at readyState 1 with networkState idle and nothing buffered after 21 s: iOS Safari stops a paused clip after its metadata until play() is called, and the plugin waited for readyState 2 before calling play(). In-view clips that have a source now get play() at any readyState; with that build the same switch loaded them straight away on the iPhone. Desktop WebKit and Chromium never showed the stall.

Limits

  • Left as designed after the review: at first render, clips within two screens keep Stash's own fetches, so they load in parallel and uncapped. Measured on the synthetic walls: 8 to 13 video fetches at once in the first 3 s at phone size, 13 to 32 at desktop size. The ordered queue governs only clips that come within reach later.
  • A review concern that kept clips (which lose autoplay and keep the browser's default preload) might never start was not reproduced in Chromium, where every in-view clip played in all 24 first-render runs. It was real on iOS Safari and is fixed (see Testing).
  • On desktop the layout is unchanged, but the video behaviour runs: only visible clips play, far-off clips are unloaded, and the stall check runs. This was already true on Markers and Images in 3.0 and now extends to the scene wall.
  • The stall check queries every wall video every 500 ms while a target page is open, including the scene grid view, where it finds nothing.
  • The decoder-eviction check cannot tell an evicted clip from one whose fetch has stalled; it now skips any clip still fetching.
  • The AV1 fallback shows the preview at lower resolution, and only for image clips whose generated preview exists. It was tested with a corrupted file in Chromium, not with Safari's AV1 failure.- At 60 per page the author sometimes sees a brief jump while scrolling, which they take to be a released clip loading again.
  • The Safari findings above are the author's own diagnosis; no WebKit bug is cited.

LLM-assisted contribution

Written with Claude Code (an LLM) under the author's direction, per this repository's rule for LLM-assisted contributions.

The author specified the behaviour, tested this build on their phone, and looked over the code. The author takes responsibility for the code.

🤖 Generated with Claude Code

…r release

Ports scrollFeed 3.1-3.7 onto the 3.0 plugin:
- play-on-visibility, ordered loading and the single-column touch layout
  now also cover the /scenes wall
- clips far off screen are unloaded (load at 2 screens, release at 5)
- wall videos lose their autoplay attribute so only the observer plays them
- a persistent canplay listener and an end-of-clip watchdog restart clips
  Safari leaves paused or frozen on their last frame
- image clips that fail to decode (AV1 in Safari) fall back to their preview
- near clips keep their src at registration to cut refetch stalls

Review fixes: the eviction re-load skips clips still fetching; a clip
released mid-load is freed from the load slot; release saves the current
src; the AV1 fallback checks the preview exists, keeps the clip's size,
restores the original if the preview fails, and leaves off-screen slides
paused; near/far distances come from one number each.

Version 3.0 -> 3.7; README and description updated.

iOS fix: an in-view clip that kept its src now gets play() at any
readyState. iOS Safari stops a paused clip after metadata (networkState
idle) until play(), and the old readyState >= 2 gate left those clips
blank until scrolled far away and back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@discourse-stashapp

Copy link
Copy Markdown

This pull request has been mentioned on Stash Forum. There might be relevant details there:

https://discourse.stashapp.cc/t/scrollfeed/6160/7

Comment on lines +3 to +6
A scrolling feed of your favorite marker clips, image clips and scene
previews, designed for private one-handed mobile viewing. Works on the
Markers, Images and Scenes walls. Just scroll for the next clip. Pairs
with the preview-cap patch (linked) for clip-length playback.

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.

Please fix text formattting.

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.

Please fix text formattting.

@DogmaDragon DogmaDragon added the type:plugin Plugins label Dec 3, 2026
…scription

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DogmaDragon
DogmaDragon merged commit 730e7f0 into stashapp:main Dec 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants