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

Add new VideoPress block support #7592

Merged
merged 5 commits into from Apr 22, 2024
Merged

Conversation

renatho
Copy link
Contributor

@renatho renatho commented Apr 18, 2024

Resolves #7514
And part of https://github.com/Automattic/sensei-pro/pull/2578

Proposed Changes

For context, VideoPress used the "Video" block previously. Now it has its own block (p7DVsv-gDF-p2) which the HTML is similar to the VideoPress embed block, so we leverage this integration.

Testing Instructions

This test instructions are for Video integrations for courses. The rest can be tested in https://github.com/Automattic/sensei-pro/pull/2578.

  1. Bump the Sensei LMS plugin version to make sure it will use this build in WPCOM when you upload.
  2. Build the plugin.
  3. Install it in a WPCOM atomic site.
  4. Create a new course and activate the video settings.
    Screenshot 2024-04-18 at 12 33 27
  5. In a lesson of the course, add a VideoPress video using the new VideoPress block.
    Screenshot 2024-04-18 at 12 34 29
  6. Access the course as a student, and make sure the video integrations are working properly.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@renatho renatho self-assigned this Apr 18, 2024
@@ -86,6 +86,7 @@
<properties>
<property name="custom_capabilities" type="array">
<element value="manage_sensei"/>
<element value="edit_course"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just fixes a PHPCS issue in the committed PHP file.

@@ -133,7 +133,7 @@ public function enqueue_frontend_scripts() {
wp_add_inline_script( 'sensei-course-video-blocks-extension', $script, 'before' );

$post = get_post();
if ( has_block( 'core/video', $post ) || has_block( 'core/embed', $post ) ) {
if ( has_block( 'core/video', $post ) || has_block( 'core/embed', $post ) || has_block( 'videopress/video', $post ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sure that the integration will be loaded also when using the videopress/video block.

@@ -162,8 +162,10 @@ const useEditorPlayer = ( videoBlock ) => {
const doc = editorCanvasIframe?.contentDocument || document;
const w = editorCanvasIframe?.contentWindow || window;

const isJetpackVideoPress = !! videoBlock.attributes
.videoPressClassNames;
const isJetpackVideoPress =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will make the integration behave the same way it happens with the VideoPress embed.

@@ -26,6 +26,8 @@ const initVideoPressPlayer = ( iframe ) => {

export const initVideoPressExtension = () => {
document
.querySelectorAll( '.wp-block-embed-videopress iframe' )
.querySelectorAll(
'.wp-block-embed-videopress iframe, .wp-block-jetpack-videopress iframe'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add new selector to also match the new block selector.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Apr 18, 2024

WordPress Dependencies Report

The github-action-wordpress-dependencies-report action has detected some script changes between the commit 6b6873d and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Dependencies Removed Dependencies Total Size Size Diff
js/frontend/course-video/video-blocks-extension.js 5.97 kB +11 B ( +0.19% 🔼 )

This comment was automatically generated by the github-action-wordpress-dependencies-report action.

@renatho renatho added this to the 4.24.0 milestone Apr 18, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

@renatho renatho requested a review from a team April 18, 2024 21:41
@renatho renatho marked this pull request as ready for review April 18, 2024 21:41
@merkushin merkushin requested review from merkushin and removed request for a team April 21, 2024 15:09
Copy link
Member

@merkushin merkushin left a comment

Choose a reason for hiding this comment

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

Thanks, Renatho! Works well 👍

@renatho renatho merged commit 41752e5 into trunk Apr 22, 2024
23 checks passed
@renatho renatho deleted the add/new-videopress-block-support branch April 22, 2024 18:58
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.

Video watch required setting does not work with VideoPress
2 participants