Optionalopts: ReplayOptionsTrue once start has run and replay is engaged (cap active).
Current playback speed in bars per second.
Index of the last revealed bar (the virtual buffer end minus one).
True while the playback timer is running.
Stop the timer and release the controller. Does not clear the engine cap.
Pause automatic playback. Keeps the current cap/index. No-op if not playing.
Begin (or resume) automatic playback. No-op when not started, already
playing, or already at the last bar. Reveals one bar every
1000 / barsPerSecond ms and auto-pauses on reaching the newest bar.
Jump directly to index (clamps into [0, length - 1]). Engages replay
if not already active. Does not change the playing state, except that
seeking to the last bar while playing auto-pauses.
Change playback speed (bars per second), clamped to a sane positive range. Restarts the running timer with the new interval so a speed change takes effect immediately mid-playback.
Enter replay mode and reveal up to (and including) fromIndex — default
0, i.e. start from the very first bar. Clamps fromIndex into
[0, length - 1]. No-op on an empty buffer. Does not start playback;
call play (or step) to advance. Re-calling start while
already playing stops the timer first.
Reveal/hide one bar. forward (default true) advances toward the live
edge; false steps back toward the start. Clamps at both ends. Auto-
pauses if a forward step reaches the newest bar. Stepping while not yet
started implicitly engages replay at the resulting index.
Leave replay mode entirely: stop the timer, clear the engine's replay cap
(so the full buffer renders again), and repaint. Emits one final
onChange(index, false) so a host can reset its UI. Idempotent-ish —
safe to call when not started.
Bar-by-bar history playback (C1, "Replay mode"). Drives the engine's replay cap so the chart reveals candles progressively from some start index up to the live edge.
Replay is strictly opt-in: until start is called the controller touches nothing, and stop clears the cap so the chart renders the full buffer exactly as before. The controller owns a single timer (started by play, stopped by pause/stop/destroy); the timer reveals one bar per tick and auto-pauses once the newest bar is shown.
The controller positions the viewport so the just-revealed bar sits at the live edge (it scrolls to
index + 1, treating the revealed prefix as the whole buffer), so playback visually tracks the revealing candle the same way the live feed tracks new appends.Interaction with
maxCandleseviction: while a cap is active the host's_enforceMaxCandlesis a no-op (the cap is an absolute index; head-eviction would silently shift which bar it points at). A long replay session under a live feed therefore lets the buffer grow pastmaxCandlesuntil stop — an intentional, bounded trade-off in favor of a stable cap.