Skip to content

feat(video): update video block - #237

Draft
marissahuysentruyt wants to merge 8 commits into
mainfrom
block-youtube
Draft

marissahuysentruyt wants to merge 8 commits into
mainfrom
block-youtube

Conversation

@marissahuysentruyt

Copy link
Copy Markdown
Collaborator

Description

Screenshots (if applicable)

Type of change

  • Bug fix
  • New feature / block
  • Refactor
  • Docs / content
  • Chore (deps, config, tooling)

Related issue(s)

  • fixes [Issue Number]

Validation steps

  • This PR has visual elements, so it was reviewed by a designer.
  • This PR has code changes, and our linters still pass.
  • This PR affects production code, so it was browser tested (see below).
  • This PR affects existing pages, so automated E2E tests were run (see below).
  • This PR has new code, so new tests were added or updated, and they pass.
  • This PR has copy changes, so copy was proofread and approved.
  • The content of this PR requires documentation, so a detailed description of the component's purpose, requirements, quirks, and instructions for use by designers and developers was added, along with accessibility information if pertinent.

To Validate

URL for testing:
https://--spectrum-hub--adobe.aem.live/

  • Make sure all PR Checks have passed
  • Pull down the branch locally or visit the branch preview
  • Run npm test and confirm all tests pass
  • Run npm run lint and confirm no linting errors
  • Verified in browser with aem up

Accessibility testing checklist

  • Keyboard
  1. Go here
  2. Do this action
  3. Expect this result
  • Screen reader
  1. Go here
  2. Do this action
  3. Expect this result

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aem-code-sync

aem-code-sync Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@marissahuysentruyt marissahuysentruyt changed the title Block youtube feat(video): update video block Dec 4, 2026
- the youtube block embedded a third-party iframe as soon as it scrolled
into view, so every video cost a full player download whether or not
anyone pressed play; the video block shows a poster and builds the
iframe only on activation
- read the video id strictly instead of trusting the last path segment,
so shorts and live URLs resolve and an unplayable URL is dropped rather
than embedded broken
- name the play control and the player from the provider's own title,
since every embed previously shared the title "Youtube Video"
- support Adobe Video Publishing Cloud alongside YouTube, because videos
are authored as links in DA from either provider
- accept a table contract as well as a link, so authors can supply a
transcript or a custom poster, neither of which a bare link expresses
- move the authored-cell readers into scripts/utils/cells.js, since the
table contract is the first thing here that needs them
- two tests awaited `new Promise(requestAnimationFrame)` to let pending work
settle before asserting that nothing further changed
- the full concurrent suite runs test pages hidden, and a hidden page fires
no animation frames, so that await never resolved and took the whole file
past the runner's 120s limit instead of failing
- wait on a timer instead, which still flushes the microtasks and the
MutationObserver callback these assertions depend on
- every other wait in the file already rejects after 2s, so these were the
only two that could hang rather than fail
- pages with video need one small play/pause control and no
scrubber, quality menu or fullscreen button, none of which a provider
iframe can offer, so short clips need a native player
- the control is built here rather than taken from the browser, since
`<video controls>` cannot be reduced to a single button
- `usage` will render video in its panels too, so the player lives in
`scripts/utils/` rather than in either block; no block imports another
- the stylesheet loads on demand, so a page without video never asks for it
- the control reads the media events rather than its own click, so its name
stays accurate when something else starts or stops playback, and a rejected
`play()` leaves it ready to retry instead of out of step
- sizing is left to the consumer, which owns its own frame
- the key/value rows came from the block this was ported from; Spectrum Hub
authors blocks by writing content in place, the way `columns` and `usage`
read theirs, so the contract now follows the content
- route an uploaded MP4 to the player added in the previous commit, since
the pages with video need one small control rather than a provider's
full chrome; YouTube and Adobe links still hand off to their own players
- take the video's name from the link text, or from the alt of a poster the
link wraps, so the name an author already writes is what a screen reader
announces and there is no separate field to forget
- read whatever follows the media as a caption, which is where the authored
explanation belongs now that the transcript row is gone
- normalize an authored `16-9` to `aspect-16-9`, since a CSS selector cannot
start with a digit, and fall back to widescreen for an unknown ratio rather
than matching no rule at all
- cap width per size class against the `columns` scale, so a large player
still shrinks on a phone instead of holding its mock dimensions
- drop `getAuthoredCells` and `getCellLinkHref`, which lost their only
consumer with the key/value rows
- motion guidance compares a recommended clip against one to avoid, which is
what `usage` already does for images, so it learns video rather than the
video block growing a comparison variant
- a link to a video file in the media cell becomes a player; any other link
is passed through untouched, so existing panels are unaffected
- the indicator, caption and panel layout are unchanged, since only what
fills the media cell differs
- move `isVideoFile`, `getVideoTitle` and the new `buildPlayerFromLink` into
the shared player module: both blocks need them and no block in this
repository imports another
- a panel frames its video 16:9, because the shared player leaves sizing to
whatever hosts it
- drive real Tab, Enter and Space against the control: focus lands on it and
moves off, activation flips the name between play and pause, and focus stays
put through both
- back the fixture with a canvas stream, so the element genuinely plays and
pauses without committing a binary; an empty source would reject play() and
never fire the event the control listens for
- cover the player on its own as well as through a block, since both `video`
and `usage` inherit this control and neither owns it
- an uploaded MP4 pasted on its own line rendered as a plain link, because
the only auto-block patterns were the three providers; match `.mp4` so the
self-hosted player is reachable the way a YouTube link already is
- match the extension rather than a path: every DA asset shares the /media/
prefix, so a path pattern would catch linked images and PDFs as well
- hand back an auto-blocked link that holds no playable video instead of
removing it. The pattern is a guess made from a URL, and a YouTube channel
or playlist matches it as readily as a video does, so a link an author
pasted could disappear from the page with only a console line to explain it
- an authored block still goes when its URL is unplayable, because that
author asked for a video and an empty frame is worse than nothing
- adding the `.mp4` pattern made the auto-block match links inside authored
video and usage blocks, which are that block's own content
- a section's link blocks load before its blocks, so the link was consumed
first and the block was left with an empty cell to read; it then found no
video and removed itself, taking the player and the author's size and ratio
with it
- recognize a link an owning block already holds and step aside, handing the
link back untouched so the block reads it a moment later
- mirror the real load order in the fixture: both lists are collected before
anything loads, so a div a link block just created is not read as a block

This branch was successfully deployed

1 active deployment
block-youtube — a7a5f6e4 Deployed Dec 4, 2026 by aem-code-sync[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.

1 participant