Skip to content

Remember playback position and order across browser-source reloads - #11

Open
orangeqoon wants to merge 1 commit into
dustymethod:masterfrom
orangeqoon:optional-playback-history
Open

orangeqoon wants to merge 1 commit into
dustymethod:masterfrom
orangeqoon:optional-playback-history

Conversation

@orangeqoon

Copy link
Copy Markdown

Reloading a browser source currently loses its position and, in random mode, reshuffles the slideshow before the previous loop has finished. With large image collections, this makes it harder to show the remaining images across OBS sessions.

This adds playback history to the existing HTML/JavaScript player, enabled by default. It stores the current image position and complete playback order in browser local storage, scoped to the full page URL, and restores both on reload. Users can opt out with rememberPlayback = false in settings.js or the new Remember playback position and order checkbox in the Lua settings. Older settings files also use the enabled default.

Behavior and compatibility:

  • Works with all four ordering modes and saves manual Next/Previous changes.
  • Restores only when the saved mode and image list still match; otherwise starts a fresh order.
  • Restart intentionally starts a fresh order and replaces the stored state when history is enabled.
  • Keeps the existing caption and autoplay settings. The restored image receives a full slide duration; paused state and elapsed time are not persisted.
  • Malformed, unavailable, or full local storage does not interrupt playback. Browser storage cleanup clears the history; sources sharing a URL and browser profile share history.
  • Adds no runtime dependencies, server, file watcher, installation-specific paths, or unrelated features.

Validation:

  • node --test tests/playback-history.test.cjs: 19 passing tests, covering all ordering modes, enabled defaults, opt-out, older settings files, navigation, restart, changed lists/modes/URLs, invalid stored data, blocked/full storage, empty/single-image lists, captions, and autoplay behavior.
  • Headless Microsoft Edge with separate persistent profiles: all four ordering modes restored position/order after both page reload and full browser restart; captions rendered.
  • git diff --check passes.

The Lua checkbox/default/output wiring is included, but the new checkbox has not been exercised interactively inside OBS. The browser checks above used Chromium/Edge with a local HTTP fixture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant