Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Block: Use existing video poster image on insert. #34415

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

@getsource
Copy link
Member

@getsource getsource commented Aug 31, 2021

Description

When selecting a video in the video block, automatically use the poster image (from a video's featured image) when it is assigned.

Side note for testing:
While working on this, I found #34411. Removing the poster does not currently work (with or without this PR), but should after #34411 is merged.

Fixes: #21553

How has this been tested?

Tested on wp-env.

From the #21553 description:

  • Go to Media -> Add New and upload a video
  • Click 'Edit' and on the attachment editing screen, select a poster image for the video in the Featured Image meta box
  • Save the video attachment

Then:

  • Create a new post
  • Insert a video block
  • Select previously created video
  • Notice that poster image is set

Screenshots

Before:

poster-before-patch.mov

After:

poster-after-patch.mov

Types of changes

Enhancement

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
@getsource getsource force-pushed the getsource:update/use-video-poster-image-on-select/21553 branch from 3ce40bf to eb4334e Sep 1, 2021
Copy link
Contributor

@ntsekouras ntsekouras left a comment

Thanks for working on this!

This change makes the video block, without a poster added by the user, show the default image, which IMO is not so good compared to the video preview that is being shown right now..

I haven't checked how and if we can obtain the default poster value and I'm not sure how we should handle it either 😄 . More opinions here would be good.

setAttributes( {
src: media.url,
id: media.id,
poster: media?.image?.src,

This comment has been minimized.

@ntsekouras

ntsekouras Sep 1, 2021
Contributor

Here media is an object, so no need to use media?..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants