Media blocks: Stop other page media when playback starts - #81389
Draft
scruffian wants to merge 1 commit into
Draft
Media blocks: Stop other page media when playback starts#81389scruffian wants to merge 1 commit into
scruffian wants to merge 1 commit into
Conversation
scruffian
force-pushed
the
agent/pause-all-page-media
branch
from
August 10, 2026 13:41
38dcd17 to
609ddde
Compare
|
Size Change: +901 B (+0.01%) Total Size: 7.65 MB 📦 View Changed
|
|
Flaky tests detected in 609ddde. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/31394144895 keeps a new post discoverable after the editor automatically autosaves it (RTC WebSocket) in
|
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.
What?
Alternative approach to #81387.
Stops other page media when a core Playlist, Audio, or Video block starts playback. Unlike #81387's core-block-only native media selector, this version coordinates with every document-level
audioandvideoelement once the media playback coordinator has loaded.Why?
Playlist blocks already avoid overlapping playlist tracks, but a Playlist block and standalone media could play together. This explores the broader behavior where starting one relevant media experience pauses other media on the page, including media outside core block wrappers.
How?
Adds a small shared frontend media playback coordinator script module for Audio and Video blocks. The coordinator listens for captured native
playevents on anyaudioorvideoelement and pauses the other native media elements on the page. Playlist waveform players still register with the coordinator because their underlying audio element is owned by the waveform library rather than discoverable in block markup.Testing Instructions
Testing Instructions for Keyboard
Validation
npm run test:unit packages/block-library/src/utils/test/media-playback.js packages/block-library/src/playlist/test/view.jsnpm run lint:js -- packages/block-library/src/utils/media-playback.js packages/block-library/src/utils/test/media-playback.js packages/block-library/src/playlist/view.js packages/block-library/src/playlist/test/view.jsnpm run lint:pkg-json -- packages/block-library/package.jsonnpm run build -- --skip-types --webpack-copy-php --webpack-bundle-analyzer=false --no-watch