Bug 230738 - MediaSession API doesn't work in Picture in Picture.
Summary: MediaSession API doesn't work in Picture in Picture.
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari Technology Preview
Hardware: All Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-23 21:18 PDT by Mitsuo Matsunaga
Modified: 2021-09-30 01:32 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mitsuo Matsunaga 2021-09-23 21:18:50 PDT
I created a simple page to try out the MediaSession API.
https://tsg02.p.uliza.jp/demo/webkit-report-/media-session-api.html

1.Open this page.
2.Press the Playback button.
3.Press the Picture in Picture button.
4.In Inspector - Sources tab, set a breakpoint in the setActionHandler('pause').
5.Press the pause button in Picture in Picture.

Do not break.

Note:
Break if I operate the control center.
Comment 1 Eric Carlson 2021-09-27 08:59:19 PDT
This is by design, it seems to me that the playback controls in the PiP window should be considered the same as the browser's default controls for inline or fullscreen playback. 

The spec's definition of a "media session action source" does leave a lot of room for interpretation, but why would the "play" button in the PiP window invoke the MediaSession action handler when the "play" button in the inline controls does not?
Comment 2 Radar WebKit Bug Importer 2021-09-29 09:19:07 PDT
<rdar://problem/83673931>
Comment 3 Mitsuo Matsunaga 2021-09-30 01:32:08 PDT
In the case of inline, our players can detect button presses using our original controller.
Our players need to perform some action when the play button is pressed.
PiP window cannot be our original controller.
Therefore, we want PiP window to be the target of MediaSession API.

Not only that, we want browser's default controls to be the target of MediaSession API.
We want to disable seek while playing an ad when fullscreen on an iOS device.