Bug 241789

Summary: Portrait HLS video first loads at small size before resizing to fit <video> element
Product: WebKit Reporter: Joshua Carter <carter.joshua.603>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: REOPENED ---    
Severity: Normal CC: webkit-bug-importer, y_soliman
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   
URL: https://mgpl43.csb.app/
See Also: https://bugs.webkit.org/show_bug.cgi?id=240604
https://bugs.webkit.org/show_bug.cgi?id=248030
Attachments:
Description Flags
A zip file containing two screenshots: the initial small rendering, and after it resizes none

Description Joshua Carter 2022-06-20 14:47:54 PDT
Created attachment 460356 [details]
A zip file containing two screenshots: the initial small rendering, and after it resizes

**What currently happens**
On **iOS 13, 14, and 15** (including the latest version of Safari - 15.5), when a **portrait** **HLS** video is first rendered (on iOS this is when it is first played), the video content initially renders much smaller than the video element (screenshot 143501) before quickly resizing to take up the full `<video>` element as expected (screenshot 143534):

**What I would expect**
When playing a video for the first time, the content, when first rendered, should fill the `<video>` element as expected.

**Example**
A reproducible example with instructions may be found here: https://mgpl43.csb.app/
Comment 1 Youssef Soliman 2022-06-20 15:59:27 PDT

*** This bug has been marked as a duplicate of bug 240604 ***
Comment 2 Joshua Carter 2022-06-20 16:21:52 PDT
@Youssef Soliman

I do not believe that https://bugs.webkit.org/show_bug.cgi?id=240604 is a duplicate of this bug for a couple of reasons:

1) 240604 happens on videos with `object-fit: cover`; however, this bug happens on videos with no `object-fit` set (defaulting to `contain`).

2) The initial rendering does not match how a rendering of `object-fit: contain` would appear. `object-fit: contain` would have the video enlarged to fill the container in one dimension. This is, in fact, what the *expected* behavior is; however, in the initial rendering, the entire video is much smaller than the container (see screenshot).

That being said, I don't have any knowledge of how this all works under the hood, so perhaps they are the same bug for a reason I don't understand.
Comment 3 Youssef Soliman 2022-06-20 17:26:51 PDT
Interesting, I assumed it was the same issue since it only affects the first frame and https://bugs.webkit.org/show_bug.cgi?id=240604#c3 mentioned that it happens to `object-fit: contain` as well.

I have a strong feeling the underlying issue is the same from my basic preliminary testing (there seems to be a delayed message between the GPU and Web Process), however, I'll unmark this as duplicate until the other issue is resolved.
Comment 4 Radar WebKit Bug Importer 2022-06-27 14:48:15 PDT
<rdar://problem/96012592>