Repository navigation
fix(vimeo-video-element): keep paused in sync when pause() is called before load - #268
Merged
Merged
Conversation
…letes on pause. Also moved event callbacks that modify this.#paused to private methods
|
@spuppo-mux is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
spuppo-mux
commented
Oct 21, 2026
Comment on lines
-264
to
-280
| #onLoaded = async () => { | ||
| this.#readyState = 1; // HTMLMediaElement.HAVE_METADATA | ||
| this.dispatchEvent(new Event('loadedmetadata')); | ||
|
|
||
| if (this.api) { | ||
| this.#muted = await this.api.getMuted(); | ||
| this.#volume = await this.api.getVolume(); | ||
| this.dispatchEvent(new Event('volumechange')); | ||
|
|
||
| this.#duration = await this.api.getDuration(); | ||
| this.dispatchEvent(new Event('durationchange')); | ||
| } | ||
|
|
||
| this.dispatchEvent(new Event('loadcomplete')); | ||
| this.loadComplete.resolve(); | ||
| }; | ||
|
|
Contributor
Author
There was a problem hiding this comment.
note: this was just moved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2ae1bb6. Configure here.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
This branch was successfully deployed
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.

Fixes #267.
Calling
pause()whileplay()was still waiting onloadCompleteleftel.paused === falsefor good.play()sets the state and dispatchesplaysynchronously, butpause()relied on Vimeo'spauseevent. Both commands reach Vimeo back to back, playback never starts, so Vimeo never emits it. Consumers that only callplay()whenpausedis true (react-player, media-chrome's play button) then never play the video again.pause()now updatespausedand dispatchespausebefore awaiting load, mirroringplay().#onPlay,#onPlaying,#onPausedand#onEndedhandle everypausedchange, from both the Vimeo listeners andplay()/pause().#onPlayand#onPausedonly act on an actual state change, so a regular pause still fires a singlepauseevent.Behavior change:
play()on an element that's already playing no longer fires a redundantplayevent, matchingHTMLMediaElement.Testing
play()thenpause()before load: fails 4 of 5 assertions onmain, passes with the fix.main: the test importmap was missingmedia-played-ranges-mixin, and both fixture videos had been deleted from Vimeo. Fixtures now use Vimeo's76979871;play promiseand the src-change test use22439234, because76979871always fails playback with aPlaybackError.npx wet test ./test/index.html --servedir .. The package'swet runscript is a no-op, so CI doesn't run these. Lint passes.Note
Medium Risk
Changes synchronous media event semantics and play/pause gating in a custom element used by players like react-player; behavior is intentional but affects timing-sensitive integrations.
Overview
Fixes
pausedgetting stuckfalsewhenplay()thenpause()happen beforeloadComplete: Vimeo may never emitpause, so consumers that gate onpausedstop working.pause()now updates internal state and dispatchespausesynchronously (matchingplay()), then awaits load and calls the Vimeo API. Play/pause/playing/ended transitions go through#onPlay,#onPaused,#onPlaying, and#onEnded, with guards so duplicate events are not fired.play()on an already-playing element no longer emits a redundantplayevent (closer toHTMLMediaElement).Tests add regressions for pre-load
pauseand earlyplay()aftersrc, fix the test importmap formedia-played-ranges-mixin, and swap fixture Vimeo IDs/durations after removed or unplayable videos.Reviewed by Cursor Bugbot for commit 4b9bdce. Bugbot is set up for automated code reviews on this repo. Configure here.