Skip to content

Add video poster image federation#2982

Merged
pfefferle merged 4 commits intotrunkfrom
add/video-poster-federation
Feb 27, 2026
Merged

Add video poster image federation#2982
pfefferle merged 4 commits intotrunkfrom
add/video-poster-federation

Conversation

@pfefferle
Copy link
Member

Reported in https://wordpress.org/support/topic/videos-poster-image/

Proposed changes:

  • Extract the poster attribute from WordPress video block HTML (<video poster="...">) and include it as the icon property on ActivityPub Video attachments, so Mastodon and other platforms can display video thumbnails.
  • Add @method PHPDoc tags to the Base transformer class for child-implemented methods (get_content, get_icon, get_id, get_name, get_summary).

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Create a post with a video block and set a poster image on it.
  • Publish the post and check the ActivityPub JSON output (append ?activitypub to the post URL).
  • Verify the video attachment includes an icon property with the poster image URL.
  • Verify posts without a poster image on the video still federate correctly without an icon.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch

Type

  • Added - for new features

Message

Add federation of video poster images set in the WordPress video block.

Extract the poster attribute from WordPress video block HTML and include
it as the icon property on ActivityPub Video attachments, allowing
Mastodon and other platforms to display video thumbnails.
Copilot AI review requested due to automatic review settings February 27, 2026 15:33
@pfefferle pfefferle self-assigned this Feb 27, 2026
@pfefferle pfefferle requested a review from a team February 27, 2026 15:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds federation support for WordPress video poster images by extracting the poster attribute and emitting it as icon on ActivityPub video attachments, plus related documentation/test updates.

Changes:

  • Extract poster from <video> HTML in video blocks and store it as icon in video media entries.
  • Prefer block-provided icon when transforming attachments, falling back to transformer get_icon().
  • Add/adjust PHPUnit coverage and PHPDoc (@method) / param docs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/phpunit/tests/includes/transformer/class-test-post.php Adds tests covering poster extraction and the “no poster” case for video blocks.
includes/transformer/class-post.php Implements poster extraction from video block HTML and stores it as icon for video media.
includes/transformer/class-base.php Documents icon in attachment media arrays and uses it to populate ActivityStreams icon.
.github/changelog/2982-from-description Adds changelog entry for the new poster-image federation feature.

- Replace regex with WP_HTML_Tag_Processor for parsing the video poster
  attribute, which properly handles HTML entities.
- Use esc_url_raw() instead of esc_url() since the value goes into
  ActivityPub JSON, not HTML output.
- Fix get_icon() return type to string|array|null.
Replace regex with WP_HTML_Tag_Processor for consistency with the video
poster parsing and to properly handle HTML entities in alt attributes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

@pfefferle pfefferle merged commit c6ef28e into trunk Feb 27, 2026
14 checks passed
@pfefferle pfefferle deleted the add/video-poster-federation branch February 27, 2026 18:10
@pfefferle pfefferle restored the add/video-poster-federation branch February 28, 2026 12:24
@pfefferle pfefferle deleted the add/video-poster-federation branch February 28, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants