Bug 172051 - `webkitSetPresentationMode('picture-in-picture');` (PiP) not working on multiple video sources
Summary: `webkitSetPresentationMode('picture-in-picture');` (PiP) not working on multi...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari Technology Preview
Hardware: Macintosh macOS 10.12
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2017-05-12 14:27 PDT by Kurt Zenisek
Modified: 2017-05-16 20:16 PDT (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Kurt Zenisek 2017-05-12 14:27:32 PDT
Checking YouTube (which uses blob: for their videos now) shows that you can use `document.getElementsByTagName('video')[0];` in Safari's console on a video player page to obtain the correct video element without issue. However, using `document.getElementsByTagName('video')[0].webkitSetPresentationMode('picture-in-picture');` at that point returns "undefined" and the video is not turned into a Picture-in-Picture (PiP).

Meanwhile right-clicking the YouTube video player (to get the context menu for the video element to show) is able to turn the video into a Picture-in-Picture without issue. I'm guessing there's a bug when it comes to the `webkitSetPresentationMode('picture-in-picture');` command being executed on video elements with a `blob:` url as it's source.
Comment 1 Kurt Zenisek 2017-05-12 14:31:50 PDT
Also, it appears that using `document.getElementsByTagName('video')[0].webkitSetPresentationMode('inline');` _works_ on a YouTube video (if you were to make it a PiP via the video element's context menu) whereas `document.getElementsByTagName('video')[0].webkitSetPresentationMode('picture-in-picture');` does not work (even if you execute this immediately after the inline command worked.)
Comment 2 Kurt Zenisek 2017-05-12 14:49:22 PDT
Finally, it appears that the use of a `javascript:document.getElementsByTagName('video')[0].webkitSetPresentationMode('picture-in-picture');` bookmarklet does work while running `document.getElementsByTagName('video')[0].webkitSetPresentationMode('picture-in-picture');` directly from Safari's console does not.

Oddly enough, the use of `document.getElementsByTagName('video')[0].webkitSetPresentationMode('picture-in-picture');` directly in the console starts working after you have used the `javascript:document.getElementsByTagName('video')[0].webkitSetPresentationMode('picture-in-picture');` bookmarklet.
Comment 3 Kurt Zenisek 2017-05-12 14:56:18 PDT
Triggering a PiP shouldn't require a bookmarklet or using the context menu of the video element while using the webkitSetPresentationMode('picture-in-picture'); command directly via the browser's JavaScript (be it an extension or via the browser's console) does not work.
Comment 4 Kurt Zenisek 2017-05-12 15:06:05 PDT
I just tested a non-blob URL, and it appears this issue isn't just restricted to `blob:` video sources.
Comment 5 Radar WebKit Bug Importer 2017-05-16 20:16:27 PDT