Skip to content

fix(vimeo-video-element): dispatch error event when the video fails to load - #264

Merged
spuppo-mux merged 3 commits into
muxinc:mainfrom
ThomasChance:fix/vimeo-not-found-unhandled-rejection
Oct 7, 2026
Merged

spuppo-mux merged 3 commits into
muxinc:mainfrom
ThomasChance:fix/vimeo-not-found-unhandled-rejection

Conversation

@ThomasChance

@ThomasChance ThomasChance commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #263

What

When the Vimeo player rejects its ready() promise (for example NotFoundError: This video does not exist. for a deleted video), <vimeo-video> now:

  • dispatches an ErrorEvent('error', { error, message }) on the element, so the error details are available to consumers (event.error, event.message), following the same pattern as peertube-video-element
  • catches the getTextTracks() rejection, which goes through the same ready() promise

This removes both unhandled promise rejections.

Tests

Added dispatches an error event when the video does not exist to test/test.js. It fails on main (no error event, test times out) and passes with this change.

Two notes on the test setup, outside the scope of this PR:

  • The package's npm test script is wet run, but the wet CLI only handles serve, test and release, so wet run exits 0 without running anything (same for the other packages using wet run).
  • test/index.html's importmap doesn't map media-played-ranges-mixin, so the element never loads in the test page. To run the suite locally I temporarily added "media-played-ranges-mixin": "https://cdn.jsdelivr.net/npm/media-played-ranges-mixin@0.1/+esm" and ran npx wet test. The new test passes; the existing tests that wait on loadComplete time out in headless Chromium on main as well as on this branch.

🤖 Generated with Claude Code


Note

Low Risk
Localized error-handling in the Vimeo custom element; no auth or data-path changes, with behavior covered by a new test.

Overview
When the Vimeo SDK rejects ready() (e.g. deleted or invalid video), <vimeo-video> now surfaces the failure like other media elements: it stores the rejection on video.error, dispatches an error ErrorEvent with event.error and event.message, and clears that state on reload. getTextTracks() rejections are caught so they don’t become a second unhandled rejection after ready() fails.

A test asserts NotFoundError for a bad URL. Demo src values in the Next.js example and package index.html load button were switched to a working Vimeo ID.

Reviewed by Cursor Bugbot for commit 5d6e0b1. Bugbot is set up for automated code reviews on this repo. Configure here.

…o load

When the Vimeo player rejects its ready promise (e.g. NotFoundError for a
deleted video), dispatch an ErrorEvent carrying the Vimeo error instead of
leaving two unhandled promise rejections.

Fixes #263

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 7, 2026

Copy link
Copy Markdown

@ThomasChance is attempting to deploy a commit to the Mux Team on Vercel.

A member of the Team first needs to authorize it.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@spuppo-mux
spuppo-mux force-pushed the fix/vimeo-not-found-unhandled-rejection branch from f8a2a37 to 5d6e0b1 Compare October 7, 2026 18:10

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5d6e0b1. Configure here.

@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
media-elements-nextjs Ready Ready Preview Oct 7, 2026 6:41pm UTC

Request Review

@spuppo-mux
spuppo-mux merged commit fa4736d into muxinc:main Oct 7, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 30, 2026
@ThomasChance
ThomasChance deleted the fix/vimeo-not-found-unhandled-rejection branch October 15, 2026 09:46

This branch was successfully deployed

1 active deployment
Preview — 5d6e0b1f Deployed Oct 7, 2026 by vercel[bot]
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.

vimeo-video-element: unhandled NotFoundError rejections when the Vimeo video does not exist

2 participants