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 playsInline option in Video block #14500

Merged
merged 6 commits into from
Mar 20, 2019
Merged

Add playsInline option in Video block #14500

merged 6 commits into from
Mar 20, 2019

Conversation

nfmohit
Copy link
Member

@nfmohit nfmohit commented Mar 18, 2019

Description

This PR closes #14422 which requests the addition of a playsInline option in the video block.

How has this been tested?

This PR has been tested by going through the following steps:

  1. Added a Video block to the Gutenberg editor.
  2. Made sure the "Playsinline" option shows up in the InspectorControls.
  3. Made sure turning it on adds the playsinline attribute to the <video> tag.

Screenshots

gutenberg-14422-min

Types of changes

This PR just mocks the other attributes in the block like "Autoplay", "Muted" and acts accordingly.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@@ -200,6 +201,11 @@ class VideoEdit extends Component {
onChange={ this.toggleAttribute( 'controls' ) }
checked={ controls }
/>
<ToggleControl
label={ __( 'Playsinline' ) }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
label={ __( 'Playsinline' ) }
label={ __( 'Play inline' ) }

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you so much @swissspidy ❤️ I was quite confused about what to set the label as 😓 Fixed in this commit.

@nfmohit nfmohit requested review from aduth, nerrad and ntwb as code owners March 18, 2019 18:54
@@ -129,6 +129,7 @@ class VideoEdit extends Component {
poster,
preload,
src,
playsinline,
Copy link
Member

Choose a reason for hiding this comment

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

Can you update this variable/attribute name to be written as playsInline? I think it is what React expects and it also reads easier that way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you so much @gziolo ❤️ Updated here.

@gziolo gziolo merged commit d6ad848 into WordPress:master Mar 20, 2019
@gziolo gziolo added this to the 5.4 (Gutenberg) milestone Mar 20, 2019
@gziolo gziolo added [Block] Video Affects the Video Block [Type] Enhancement A suggestion for improvement. labels Mar 20, 2019
@gziolo
Copy link
Member

gziolo commented Mar 20, 2019

Thanks for yet another contribution 😃

@nfmohit
Copy link
Member Author

nfmohit commented Mar 20, 2019

Thank you so much @gziolo ❤️

@fienen
Copy link

fienen commented Jun 24, 2019

It looks like this has been merged into Gutenberg master, but I'm not seeing the option in WordPress 5.2.2 still. Has the base version of Gutenberg in WordPress itself not been updated to the version including this patch yet?

@aduth
Copy link
Member

aduth commented Jun 25, 2019

@fienen Only features from Gutenberg 5.3 and earlier were included in WordPress 5.2.x , which means it's not expected this is present in 5.2.2 (this was included in Gutenberg 5.4).

mmtr added a commit to Automattic/jetpack that referenced this pull request Aug 7, 2019
…#13134)

Add the video settings allowing to customize several options for the VideoPress player rendered by the video block (extended by our VideoPress extension for Gutenberg).

Now, after inserting a VideoPress-enhanced video block, a user can set the following settings:
- Autoplay: whether to start playing as soon as the player renders (note that some browsers can prevent a video from being autoplayed).
- Loop: whether to loop the video.
- Muted: whether the video should start in a muted state.
- Playback controls: whether show the controls to allow the user to control video playback.
- Preload: what content is loaded before the video is played:
  - None: Indicates that the video should not be preloaded.
  - Metadata: Indicates that only video metadata (e.g. length) is fetched.
  - Auto: Indicates that the whole video file can be downloaded, even if the user is not expected to use it.
- Poster image: image to be shown while the video is downloading.

Given that these settings modifies the URL saved in the block content, any existing post containing a VideoPress-enhanced video block would result in a "invalid content" error. In order to support those posts, a deprecated version of the block has been added.

These changes also introduces a new `playsInline` attribute (added in core in WordPress/gutenberg#14500), but it's currently unmodifiable, since VideoPress doesn't support it yet.
@danihazler
Copy link

Sorry, but I still get the following warning when I add a video block to my page.
WordPress 5.7

index.js:1 Warning: Invalid DOM property `playsinline`. Did you mean `playsInline`?
    in video
    in figure

@Soean
Copy link
Member

Soean commented Jul 12, 2021

@danihazler Thanks for your feedback, this is an old PR. Can you open a new issue? Which browser are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Video Affects the Video Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Video block should have playsinline option
7 participants