Skip to content

Conversation

@im3dabasia
Copy link
Contributor

@im3dabasia im3dabasia commented Mar 3, 2025

What?

Closes #41573

Why?

Video blocks with autoplay enabled fail to work properly on iOS devices. While the muted attribute is automatically added when autoplay is toggled on, iOS devices specifically require the playsinline attribute to properly autoplay videos.

The current implementation ignores this iOS-specific requirement, resulting in a poor user experience for a significant portion of users, as iOS devices represent a large market share.

How?

This PR extends the existing autoplay logic to automatically set both muted and playsinline attributes when autoplay is enabled. When a user toggles on autoplay:

  1. The muted attribute is set to true (existing behavior)
  2. The playsInline attribute is now also set to true (new behavior)

Additionally, I've added a help text that informs users when "Play inline" is automatically enabled due to autoplay settings.

Testing Instructions

(You'll need to use an actual iPhone or a simulator for this)

  1. Create a new post or edit an existing one
  2. Add a Video block and upload a video
  3. Enable autoplay in the block settings
  4. Preview or publish the post
  5. Verify that the video automatically plays when it appears on screen (Check in iphone)

Screenshots or screencast

Before

pre_playsinline.MP4

After

post_playsinline.MP4

@im3dabasia im3dabasia marked this pull request as ready for review March 24, 2025 11:37
@github-actions
Copy link

github-actions bot commented Mar 24, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: fluiddot <[email protected]>
Co-authored-by: gturpin-dev <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Video Affects the Video Block labels Apr 9, 2025
@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. and removed [Type] Bug An existing feature does not function as intended labels Aug 19, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Sorry for the late reply. Given #69232, I think this approach makes sense 👍

Just to be sure, can you rebase this PR on top of trunk before merging?

@t-hamano
Copy link
Contributor

t-hamano commented Aug 19, 2025

@im3dabasia have you ever merged the approved PR yourself? I think you're already a member of the Gutenberg repo, so if you haven't already, give it a go 👍

When merging any PR, don't forget to add the props list. It would also be good to align the commit message with the PR title if there is a difference between them.

merge

@im3dabasia im3dabasia merged commit f3dd905 into WordPress:trunk Aug 20, 2025
67 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.5 milestone Aug 20, 2025
adamsilverstein pushed a commit to adamsilverstein/gutenberg that referenced this pull request Aug 20, 2025
Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: fluiddot <[email protected]>
Co-authored-by: gturpin-dev <[email protected]>
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.

[iOS] Block Vidéo with autoplay not working

2 participants