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.
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?
<rdar://problem/83673931>
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.