Bug 203933 - Picture-in-Picture events are not fired if we switch the Picture-in-Picture mode through modern media controls
Summary: Picture-in-Picture events are not fired if we switch the Picture-in-Picture m...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Peng Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-11-06 17:23 PST by Peng Liu
Modified: 2019-11-12 07:39 PST (History)
10 users (show)

See Also:


Attachments
Patch (3.93 KB, patch)
2019-11-06 17:31 PST, Peng Liu
no flags Details | Formatted Diff | Diff
Patch (1.83 KB, patch)
2019-11-11 14:42 PST, Peng Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peng Liu 2019-11-06 17:23:24 PST
Picture-in-Picture events are not fired when enter/exit the Picture-in-Picture mode through modern media controls
Comment 1 Radar WebKit Bug Importer 2019-11-06 17:24:54 PST
<rdar://problem/56966334>
Comment 2 Peng Liu 2019-11-06 17:31:50 PST
Created attachment 382990 [details]
Patch
Comment 3 Eric Carlson 2019-11-06 18:39:24 PST
Comment on attachment 382990 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=382990&action=review

> Source/WebCore/Modules/modern-media-controls/media/pip-support.js:55
> -        media.webkitSetPresentationMode(media.webkitPresentationMode === PiPMode ? InlineMode : PiPMode);
> +        if (!document.pictureInPictureElement)
> +            media.requestPictureInPicture();
> +        else
> +            document.exitPictureInPicture();

Is this required, or is the change just modernize the controls code? 

If it is required, does that mean that existing code that uses video.webkitSetPresentationMode (e.g. all WebKit-specific PiP code) won't behave correctly?
Comment 4 Peng Liu 2019-11-06 20:53:04 PST
Comment on attachment 382990 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=382990&action=review

>> Source/WebCore/Modules/modern-media-controls/media/pip-support.js:55
>> +            document.exitPictureInPicture();
> 
> Is this required, or is the change just modernize the controls code? 
> 
> If it is required, does that mean that existing code that uses video.webkitSetPresentationMode (e.g. all WebKit-specific PiP code) won't behave correctly?

It is required. The video.webkitSetPresentationMode() will continue working, but if we use it, the video element won't fire the events defined in the picture-in-picture API spec (enterpictureinpicture, leavepictureinpicture) properly.
Comment 5 Peng Liu 2019-11-07 22:05:52 PST
In Bug 203989, we will let video.webkitSetPresentationMode() fire the events like the interface defined in the picture-in-picture API spec.
Comment 6 WebKit Commit Bot 2019-11-08 10:06:51 PST
Comment on attachment 382990 [details]
Patch

Clearing flags on attachment: 382990

Committed r252240: <https://trac.webkit.org/changeset/252240>
Comment 7 WebKit Commit Bot 2019-11-08 10:06:52 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Truitt Savell 2019-11-11 10:17:59 PST
It looks like the changes in: https://trac.webkit.org/changeset/252240/webkit

caused two tests to timeout:
media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html 
media/modern-media-controls/pip-support/pip-support-click.html

history:
https://results.webkit.org/?suite=layout-tests&suite=layout-tests&test=media%2Fmodern-media-controls%2Fmedia-controller%2Fmedia-controller-inline-to-fullscreen-to-pip-to-inline.html&test=media%2Fmodern-media-controls%2Fpip-support%2Fpip-support-click.html


Can this be looked at today?
Comment 9 Peng Liu 2019-11-11 10:21:00 PST
Got it, will look into them now. Thanks!
Comment 10 Peng Liu 2019-11-11 14:42:41 PST
Reopening to attach new patch.
Comment 11 Peng Liu 2019-11-11 14:42:42 PST
Created attachment 383302 [details]
Patch
Comment 12 Peng Liu 2019-11-11 14:43:48 PST
Comment on attachment 383302 [details]
Patch

This patch can fix the timeout failure of media/modern-media-controls/pip-support/pip-support-click.html.
Comment 13 Peng Liu 2019-11-11 14:56:54 PST
(In reply to Truitt Savell from comment #8)
> It looks like the changes in: https://trac.webkit.org/changeset/252240/webkit
> 
> caused two tests to timeout:
> media/modern-media-controls/media-controller/media-controller-inline-to-
> fullscreen-to-pip-to-inline.html 
For this layout test, can we disable it for mac-wk1 for now? It is related to the test runner updates that need to be done in bug 203723. Also, I need to look into bug 183490 to see the related media control bugs.
Comment 14 WebKit Commit Bot 2019-11-12 07:39:56 PST
Comment on attachment 383302 [details]
Patch

Clearing flags on attachment: 383302

Committed r252365: <https://trac.webkit.org/changeset/252365>
Comment 15 WebKit Commit Bot 2019-11-12 07:39:58 PST
All reviewed patches have been landed.  Closing bug.