swissspidy / media-experiments

WordPress media experiments
GNU General Public License v2.0
72 stars 1 forks source link

Core integration notes #569

Open swissspidy opened 1 month ago

swissspidy commented 1 month ago

Working draft for things to take care of when merging into Gutenberg.

Video poster in video block

Update the onFileChange callback (onSelectVideo) to get the video's poster image from the REST API response. Right now it only supports/expects the format returned by the media modal (from wp_prepare_attachment_for_js()).

https://github.com/WordPress/gutenberg/blob/e0a413d213a2a829ece52c6728515b10b0154d8d/packages/block-library/src/video/edit.js#L94

https://github.com/WordPress/gutenberg/blob/e0a413d213a2a829ece52c6728515b10b0154d8d/packages/block-library/src/video/edit.js#L152-L153

The poster URL will be accessible via media._embedded['wp:featuredmedia'][0].source_url as long as media upload (and sideload) happens with ?_embed=wp:featuredmedia

Update callbacks in the upload queue as well:

https://github.com/swissspidy/media-experiments/blob/e077f6310a78bfcfde9f8809c55b402605769a05/packages/upload-media/src/store/actions.ts#L1358-L1365

Video placeholder

Adapt https://github.com/WordPress/gutenberg/pull/63643 for the video block

Save lock

Partially revert https://github.com/WordPress/gutenberg/pull/41120 as the locking needs to happen before the actual upload