feat: replace reload with full rewind to avoid crashes#112
Open
matthewdean wants to merge 4 commits into
Open
Conversation
Add perform_rewind() which stops the current movie, fully resets player state, and reloads from the stored DirectorFile. Modeled after the transition_to_net_movie pattern. Key changes to player lifecycle: - stop() now calls sound_manager.stop_all() and dispatches playback state change to JS - reset() clears additional state: frame_script_instance, frame_script_member, last_initialized_frame, virtual_scripts - play() resumes without re-running init sequence if movie_initialized - run_movie_init_sequence() checks should_cancel_init() at await points to bail early on rewind/stop during init Rewind is signaled via pending_rewind flag, processed by the frame loop or the play task after exit. When the movie is already stopped (e.g. after a script error), rewind is dispatched directly via spawn_local. Also cleans up dead code in stop(), simplifies sound channel pause/resume methods.
Wire onPlaybackStateChanged from Rust through dirplayer-js-api to the Redux store so UI components can reactively track whether the movie is playing or stopped.
Replace reset button with rewind/stop/play controls using Director- inspired layout. Button active state is driven by isPlaying from the Redux store, so it reflects script errors and other state changes. - Rewind (backward-step icon), Stop, Play order - IconButton supports active prop with subtle pressed style - Tooltips on all buttons - 8px gap between buttons to match debugger toolbar
Contributor
Snapshot Test Report (native)1 of 2 snapshots differ from reference. Red pixels indicate changes. Generated by CI — 2026-04-06T03:40:47Z |
Contributor
Snapshot Test Report (browser)All 0 snapshots match the reference images. Generated by CI — 2026-04-06T03:45:22Z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Frequently when testing movies, I want to play from initial state. Reloading often resulted in crashes. This changes reset to be a full rewind (borrowing the Director control panel concept) which reverts the movie back to its state immediately post-parsing.
onPlaybackStateChangedcallback so UI reflects script errors and other state changesKnown limitations