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

VideoPress v5: Plays inline setting not saving for Atomic sites w/o VideoPress #6671

Open
SiobhyB opened this issue Feb 23, 2024 · 1 comment · Fixed by Automattic/jetpack#35981
Labels
Jetpack Bug or feature related to Jetpack [Type] Bug Something isn't working Video block

Comments

@SiobhyB
Copy link
Contributor

SiobhyB commented Feb 23, 2024

Describe the bug

The plays inline setting is not working in the Video block for Atomic sites w/o VideoPress enabled. As part of his report here, @fluiddot suggested the following workaround as a solution:

diff --git forkSrcPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js forkDstPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js
index 2c6b81eae8cd005e7b83036f217a93dc3438d54f..6bdff0d8fc893f8a0710b9406fbb9b0ab4b139a9 100644
--- forkSrcPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js
+++ forkDstPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js
@@ -42,7 +42,15 @@ const VideoPressSave = CoreVideoSave => props => {
 		 * @see https://github.com/WordPress/gutenberg/blob/c5f9bd88125282a0c35f887cc8d835f065893112/packages/editor/src/hooks/generated-class-name.js#L42
 		 * @see https://github.com/Automattic/wp-calypso/pull/30546#issuecomment-463637946
 		 */
-		return CoreVideoSave( props );
+
+		// Rename `playsinline` to `playsInline` to conform the block schema of core Video block.
+		const { playsinline: videoPressPlayinline, ...restAttributes } = props.attributes;
+		const coreVideoAttributes = { ...restAttributes, playsInline: playsinline };
+
+		return CoreVideoSave( {
+			...props,
+			attributes: coreVideoAttributes,
+		} );
 	}
 
 	const url = getVideoPressUrl( guid, {

To Reproduce

Steps to reproduce the behavior:

  1. Set up an Atomic site and disable VideoPress (this can be done via the Jetpack admin panel).
  2. In the app, navigate to the site's post editor.
  3. Add a video block and upload any video to it.
  4. Open the block's settings panel and toggle the "plays inline" setting on.
  5. Save your changes and exit the post.
  6. Navigate to the post editor containing the video on the web.
  7. Notice that "plays inline" is not toggled on when viewing the settings on the web.

Expected behavior

The setting should persist across platforms.

Additional context

It's worth highlighting that this isn't a recent regression. Prior to VideoPress v5 being implemented, the setting was broken in the app for all site types (ref: #1721). It's now only broken for Atomic sites w/o VideoPress enabled.

@SiobhyB
Copy link
Contributor Author

SiobhyB commented Feb 28, 2024

Note, the proposed workaround was implemented in Automattic/jetpack#35981, but we needed to revert due to it causing a regression in Atomic sites w/VideoPress enabled on the web.

@SiobhyB SiobhyB removed their assignment Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Jetpack Bug or feature related to Jetpack [Type] Bug Something isn't working Video block
Projects
None yet
1 participant