Bug 225963

Summary: REGRESSION: Video element disappears after setting currentTime to 0
Product: WebKit Reporter: Johannes Odland <johannes.odland>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: REOPENED ---    
Severity: Normal CC: ahmad.saleem792, dburkart, eric.carlson, hunter, jer.noble, johannes.odland, karlcow, webkit-bug-importer, westbrook.johnson
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: iPhone / iPad   
OS: iOS 14   
Attachments:
Description Flags
Screenshot of test case in simulator showing blue background
none
Video showing element disappearing and the blue background showing through
none
Screenshot of the bug on iOS 17.0.3 / iPhone 15 none

Description Johannes Odland 2021-05-18 23:55:26 PDT
Steps to reproduce: 
1. set preload=auto on video element
2. set currentTime=0 on loadedmetadata event

Expected behaviour: 
Video is visible and shows first frame.
Works in iOS <= 13 and other browsers

Result in iOS 14.5:
Video disappear

https://codepen.io/johannesodland/pen/PopbbQw
Comment 1 Eric Carlson 2021-05-19 15:41:15 PDT
The video element doesn't disappear, the poster frame is hidden and the first frame of the video happens to be black. 

This is the correct behavior according to the HTML spec. The first step in the algorithm is "Set the media element's show poster flag to false" [1], which hides the poster frame.

[1] https://html.spec.whatwg.org/#seeking:dom-media-currenttime
Comment 2 Johannes Odland 2021-05-19 22:04:21 PDT
Created attachment 429134 [details]
Screenshot of test case in simulator showing blue background

The first frame is black, and that is the expected behaviour. 

Unfortunately the video disappears and the blue background is visible.
Comment 3 Johannes Odland 2021-05-19 22:32:02 PDT
I'm not sure if this is related, but we've also noticed a visible flash between the poster and the first video frame when triggering .play() in the latest iOS Safari. 

It is as if the poster frame is hidden before there's a visible video frame.
Comment 4 Johannes Odland 2021-05-25 04:55:10 PDT
Created attachment 429643 [details]
Video showing element disappearing and the blue background showing through

Eric

The video element does indeed disappear. The blue background shows where the black first frame should have shown.


Please check the attachments.
Comment 5 Johannes Odland 2021-05-25 05:20:25 PDT
Video disappears and lightblue background shows through on iOS 14.5.1 (See attachments)

First frame (black) is not visible.
Comment 6 Radar WebKit Bug Importer 2021-05-25 23:56:17 PDT
<rdar://problem/78497571>
Comment 7 Johannes Odland 2021-11-08 22:13:02 PST
The issue seems to be fixed in Safari 15. 

There is still a few frames after the poster is hidden where the background shows through, before the video itself is painted:

This is reported in a separate bug:

https://bugs.webkit.org/show_bug.cgi?id=226960
Comment 8 Johannes Odland 2021-11-08 22:20:06 PST
Sorry. I was mistaken in the previous comment. 

The issue still persist on Safari 15 on iOS. 
It does not affect Safari 15 on macOS.
Comment 9 Johannes Odland 2022-03-16 00:22:48 PDT
Will this be fixed by https://bugs.webkit.org/show_bug.cgi?id=226960
Comment 10 Ahmad Saleem 2023-10-12 14:00:25 PDT
I am unable to reproduce this bug in iOS 17.0.3 using iPhone 13 Pro Max using codepen from Comment 0 and don't get just 'Blue' background.

Appreciate if someone else can also confirm, so we can close it.

CCing - Karl (if he can help) and Dana.
Comment 11 Johannes Odland 2023-10-12 22:36:48 PDT
Sorry for not following up on this bug. 

I retested on the following: 
- iOS 16.1 / Simulator
- iOS 17.0 / Simulator
- iOS 17.0.3 / iPhone 15

The video disappear on all of the devices when you set currentTime to 0.
Comment 12 Johannes Odland 2023-10-12 22:39:15 PDT
Created attachment 468199 [details]
Screenshot of the bug on iOS 17.0.3 / iPhone 15

Attaching a screenshot of the bug on iOS 17.0.3

After a few seconds, the video poster disappears, but no video frame is drawn, so the lightblue background show through.
Comment 13 Johannes Odland 2023-10-12 22:42:04 PDT
This bug seems related to https://bugs.webkit.org/show_bug.cgi?id=226960. That bug is closed as fixed, but it is still reproducible on iOS 17.