WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Video Block: First frame not shown as the poster on iOS Safari — Fix: Use Fragment URL #51995

Open porg opened 1 year ago

porg commented 1 year ago

WordPress Video Block - First frame not shown as the poster on iOS Safari

Bug and workaround widely known

Officially reported in WebKit issue tracker too

Solution aka Quick Fix: Append Fragment URL #t=0.001

Hack for iOS Safari to display the HTML video thumbnail (by MuffinMan.io, in 2020-05) in essence:

<video><source src="path-to-video.mp4#t=0.001" type="video/mp4" /></video>

Proposed Fix for Wordpress Video Block

Reproduction

  1. In the Block Editor insert a video block into a page or post.
    • Video source: MP4 with a H264 video codec, no audio track.
    • Settings for the Video block
      • Autoplay: OFF
      • Loop: OFF
      • Muted: ON
      • Playback controls: ON
      • Play inline: ON
      • Preload: Tried all 3 settings: Auto | Metadata | None — Made no difference for the bug!
      • Poster Image: None set — I want myself to spare this, and let the web browser load the first frame as its poster (First HTTP request with a byte range 0-1 for the moov atom (aka quickstart) and then a second request with a byte range of few KB for the first frame)
  2. Save the page.
  3. Open the page on an iPhone (I used Mobile Safari 15.6.3 on iOS 15.7.5)
    • Actual: You only see the Play button (white triangle on grey circle)
    • Expected: You also see the first frame of the video.

Workaround — Manually add media fragment to URL of every video block instance on your website

  1. Add video to Media Library (optional)
  2. Insert video block and choose video from the Media Library or externally hosted video URL.
  3. Select video block → Toolbar → Replace → Current media URL → Edit
  4. Append your Media Fragment #t=0.001 to the URL and then APPLY.
  5. Save page
  6. Reload in Mobile Safari: ✅ First frame now shown as the poster.

WordPress Video Block - First frame not shown as the poster on iOS Safari - Manual fix by adding media fragment to URL

WordPress information

Affected devices / versions

fluiddot commented 1 year ago

Hey @porg 👋 , thanks for reporting the issue. The "Mobile App - i.e. Android or iOS" label is usually set for issues affecting the WordPress/Jetpack app. Based on the issue's description, I understand that it's related to the web editor when using the mobile browser, is this accurate? If so, I'd consider removing the label and maybe using a different one like "Mobile Web". Thanks!

porg commented 1 year ago

I'm just a reporter, not staff. Could you please label/move the issue as it should be? Thanks!

fluiddot commented 1 year ago

I'm just a reporter, not staff. Could you please label/move the issue as it should be? Thanks!

Sure, I'll update the labels. Thanks!

porg commented 1 year ago
porg commented 1 year ago

Update: Affects also newest iOS and devices: iPhone 14 Plus, iOS 16, Mobile Safari (tested on Browserstack.com)

Updated "Environment" info in issue description.