Bug 238579

Summary: Add a heuristic to identify and extract the prominent video element in element fullscreen
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: MediaAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, calvaris, cdumez, changseok, cmarcelo, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, kangil.han, katherine_cheney, megan_gardner, philipj, sergio, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 238607    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
jer.noble: review+
Patch for landing none

Description Wenson Hsieh 2022-03-30 16:10:03 PDT
.
Comment 1 Wenson Hsieh 2022-03-30 17:05:40 PDT Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2022-03-30 21:41:31 PDT Comment hidden (obsolete)
Comment 3 Wenson Hsieh 2022-03-31 07:45:54 PDT
Created attachment 456235 [details]
Patch
Comment 4 Jer Noble 2022-03-31 14:16:04 PDT
Comment on attachment 456235 [details]
Patch

Nit: it appears this heuristic depends on the video element already existing in the page when fullscreen mode is entered. You may want consider a mutation observer, or listening for events bubbled up to the fullscreen element itself (like 'loadstart', 'play' or 'pause') to trigger recalculation of this heuristic.
Comment 5 Wenson Hsieh 2022-03-31 14:27:32 PDT
Thanks for the review!

(In reply to Jer Noble from comment #4)
> Comment on attachment 456235 [details]
> Patch
> 
> Nit: it appears this heuristic depends on the video element already existing
> in the page when fullscreen mode is entered. You may want consider a
> mutation observer, or listening for events bubbled up to the fullscreen
> element itself (like 'loadstart', 'play' or 'pause') to trigger
> recalculation of this heuristic.

Indeed! That is an omission from this iteration of the heuristic (as well as the case where m_mainVideoElement is unparented while in element fullscreen mode, and replaced with a new video element).

I was initially planning to address this in a future patch by overriding HTMLMediaElement's tree insertion/removal method hooks (as well as other media-related methods), but I think the approach of listening for media-related events bubbled up to the fullscreen element is a lot more elegant — I'll go with that approach, and add a FIXME as well.
Comment 6 Wenson Hsieh 2022-03-31 14:41:22 PDT
Created attachment 456284 [details]
Patch for landing
Comment 7 EWS 2022-03-31 22:53:59 PDT
Committed r292205 (249108@main): <https://commits.webkit.org/249108@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 456284 [details].
Comment 8 Radar WebKit Bug Importer 2022-03-31 22:55:15 PDT
<rdar://problem/91146510>