| Summary: | document pictureInPictureElement is null if you Enter Picture in Picture from contextual menu | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Jeff Johnson <opendarwin> | ||||
| Component: | Media | Assignee: | Peng Liu <peng.liu6> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | cdumez, changseok, darin, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, kondapallykalyan, mitz, pdr, peng.liu6, philipj, sergio, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari 14 | ||||||
| Hardware: | Mac (Apple Silicon) | ||||||
| OS: | macOS 11 | ||||||
| Attachments: |
|
||||||
|
Description
Jeff Johnson
2021-03-12 09:25:33 PST
I also just discovered that the video enterpictureinpicture event doesn't get posted when you using the contextual menu. The enterpictureinpicture does get posted when you use the PiP widget. I debugged with the WebKit source code and discovered the problem. In the case of clicking the PiP widget it follows this code path: HTMLVideoElementPictureInPicture::requestPictureInPicture HTMLVideoElement::setPresentationMode HTMLMediaElement::enterFullscreen In the case of the contextual menu it follows this code path: HitTestResult::toggleEnhancedFullscreenForVideo HTMLMediaElement::enterFullscreen In both cases, eventually this code gets called at https://github.com/WebKit/WebKit/blob/main/Source/WebCore/html/HTMLVideoElement.cpp#L504 void HTMLVideoElement::didEnterFullscreenOrPictureInPicture(const FloatSize& size) { if (m_enteringPictureInPicture) { However, m_enteringPictureInPicture is false with the contextual menu. With the PiP widget m_enteringPictureInPicture is true, because it gets set to true in HTMLVideoElement::setPresentationMode at https://github.com/WebKit/WebKit/blob/main/Source/WebCore/html/HTMLVideoElement.cpp#L490 Thanks for the investigation! I will upload a patch to fix it. Created attachment 423299 [details]
Patch
Committed r274551: <https://commits.webkit.org/r274551> All reviewed patches have been landed. Closing bug and clearing flags on attachment 423299 [details]. |