Follow seeks (scrub-while-paused) and add pauseAutoscroll/resumeAutoscroll#223
Open
maboa wants to merge 1 commit into
Open
Follow seeks (scrub-while-paused) and add pauseAutoscroll/resumeAutoscroll#223maboa wants to merge 1 commit into
maboa wants to merge 1 commit into
Conversation
Resolves #222 (core + pause hook). Core change: BasePlayer now attaches a 'seeked' listener that calls a new HyperaudioLite.handleSeeked() method, updating transcript visual state and scroll position whenever the media is scrubbed — including while paused. The non-DOM player adapters (SoundCloud, YouTube, Vimeo, VideoJS) override attachEventListeners so they're unaffected by this change; adding seek-follow there is a follow-up. Pause hook: pauseAutoscroll() / resumeAutoscroll() document the supported way to temporarily disable autoscroll (e.g. while a user edits the transcript), replacing the unsupported pattern of poking instance.autoscroll directly. scrollContainer constructor option deferred to #217 (options-object refactor) where it belongs.
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.
Resolves the core + pause-hook parts of #222. The
scrollContainerconstructor option is deferred to #217 (options-object refactor) where it belongs without further bloating the positional signature.Changes
Core — follow seeks
BasePlayer.attachEventListenersnow attaches aseekedlistener that calls a newHyperaudioLite.handleSeeked()method. On every seek (including while paused) the transcript's read/unread visual state and scroll position re-align to the new playhead. The word-level.activeclass is not toggled here — that suppression-while-paused behaviour is tracked separately in #220.This means scrubbing the media (drag the seek bar, jump in the native controls, set
currentTimeprogrammatically) now updates the transcript out of the box. Downstream consumers like the Hyperaudio Lite Editor that currently glue this themselves can drop their reimplementation.The non-DOM player adapters (SoundCloud, YouTube, Vimeo, VideoJS) override
attachEventListeners, so they're unaffected by this change. Adding seek-follow to each of those would be a sensible follow-up.Pause hook
Two thin documented helpers:
These wrap the existing
instance.autoscrollboolean — no behaviour change, just a supported API instead of poking the field.scrollContainer (deferred)
Adding
scrollContaineras an 8th positional constructor argument would push the signature further into "boolean parameter trap" territory. Better landed alongside the options-object refactor in #217 — added a note there.Compat
Test plan
npm test— all 25 Jest tests pass<video>example — scrub while paused, confirm transcript scroll + read/unread state follow<video>example —pauseAutoscroll()from console, scrub, confirm no scroll;resumeAutoscroll(), confirm scroll resumes