NEW252765
Picture-in-Picture API requestPictureInPicture() method fails in webview and some other circumstances
https://bugs.webkit.org/show_bug.cgi?id=252765
Summary Picture-in-Picture API requestPictureInPicture() method fails in webview and ...
Evan
Reported 2023-02-22 12:51:22 PST
When launching a webpage via email link (e.g. via gmail app) on iOS 16.3 and trying to then call requestPictureInPicture() on video element on the page, the following error is logged: NotSupportedError: The video element does not support the Picture-in-Picture mode. Just before calling this method, the following are verified: video.readyState == 4 video.disablePictureInPicture == false document.pictureInPictureEnabled == true document.pictureInPictureElement == null Action is triggered by user action. This behavior can be reproduced using the online MDN example: 1. Launch link via application on iOS (not directly in Safari - I used link in an email from the gmail app): https://developer.mozilla.org/en-US/docs/Web/API/Picture-in-Picture_API#examples 2. Go to the 'Examples' section on this page and click the 'Toggle Picture-in-Picture' button. 3. Observe the NotSupportedError in the console log.
Attachments
Sam Sneddon [:gsnedders]
Comment 1 2023-02-22 16:35:30 PST
What browser do you have selected in Gmail for links to open in? Safari?
Evan
Comment 2 2023-02-22 16:51:50 PST
(In reply to Sam Sneddon [:gsnedders] from comment #1) > What browser do you have selected in Gmail for links to open in? Safari? Safari.
Evan
Comment 3 2023-02-23 08:19:41 PST
It appears that requestPictureInPicture() is also unsupported if the video element source is camera (via getUserMedia()). This is true regardless of whether or not the request is made in a webview or in pure Safari. This can be reproduced with this example URL: https://ejdesmarais.github.io/pictureInPictureTester/ 1. Go to the above link in Safari (not in a webview) 2. Allow camera permission when asked 3. Click the "PiP (Web API)" button. This calls requestPictureInPicture on the video element. 4. Observe the NotSupportedError in the console log, or on the screen. 5. Click the 'Use mp4 instead' button. This will reload the page and use a mp4 as the video source instead of the GUM source. 6. Click the "PiP (Web API)" button. Picture-in-picture will activate as expected.
Radar WebKit Bug Importer
Comment 4 2023-03-01 12:52:14 PST
Note You need to log in before you can comment on or make changes to this bug.