Skip to content

Only fall back to muted playback on NotAllowedError - #951

Open
daveyijzermans wants to merge 1 commit into
AlexxIT:masterfrom
daveyijzermans:pr-notallowederror-mute
Open

Only fall back to muted playback on NotAllowedError#951
daveyijzermans wants to merge 1 commit into
AlexxIT:masterfrom
daveyijzermans:pr-notallowederror-mute

Conversation

@daveyijzermans

Copy link
Copy Markdown

play() treats every video.play() rejection as an autoplay-policy block and permanently sets video.muted = true.

Only NotAllowedError means "autoplay blocked". Transient rejections — e.g. AbortError when a stream reconnects or a conditional card re-shows mid-play — also trigger the fallback today, silently muting the video forever. This especially bites kiosk setups running Chromium with --autoplay-policy=no-user-gesture-required (where NotAllowedError can never occur) with .controls hidden via CSS, so nothing can ever unmute. A fresh page load plays unmuted, showing policy is not the blocker — the mute is accumulated runtime damage.

This gates the mute-fallback on er.name === 'NotAllowedError'; other rejections are only logged.

rejection before after
NotAllowedError (autoplay blocked) mute + retry mute + retry (unchanged)
AbortError / other transient permanently muted logged, stays unmuted

Running for several weeks on a kiosk that previously went silent every few days: no regressions, no more silent muting.

🤖 Generated with Claude Code

The play() fallback treated every rejection as an autoplay-policy block
and permanently muted the video. Transient rejections (e.g. AbortError
when a new load interrupts play during stream reconnect or conditional
card re-show) also tripped it, leaving kiosks silent until a full page
reload. Only fall back to muted playback on NotAllowedError.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant