Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I trigger picture in picture on Safari 10

Safari 10 introduces picture in picture. The button is there for html5 video standard controls, but how do I trigger it by javascript?

Apple says:

If you use custom HTML5 video controls, you can add Picture in Picture functionality using the JavaScript presentation mode API.

With no further references.

like image 834
Martin Algesten Avatar asked Sep 21 '16 05:09

Martin Algesten


People also ask

How do you enable Picture in Picture on Safari?

In the Safari app on your Mac, navigate to the web video you want to play. Click and hold the Audio button in the Smart Search field or in a tab. Choose Enter Picture in Picture. You can drag the window to any corner of the screen and the window stays put, even if you switch desktop spaces.

Does Safari have Picture in Picture?

PiPifier is a native macOS 10.12 Safari extension that lets you use every HTML5 video in Picture in Picture mode. If you have an HTML5 video playing on any website like Youtube just press the PiPifier icon in Safari's toolbar to enable Picture-In-Picture for this video.

Why is Picture in Picture not working on Safari?

Restart Your iPhone. If the video player app supports PIP mode, but not working, then try to reboot your iPhone. It could be due to some minor software glitch that making you going through this issue. And simply restarting the device can resolve the issue.

How do you trigger a Picture in a Picture?

Turning picture-in-picture ON To turn on, tap Allow picture-in-picture. General. Toggle picture-in-picture to on .


1 Answers

Use Javascript to activate the picture-in-picture mode. It will run by this way.

document.querySelector("video").webkitSetPresentationMode("picture-in-picture")
like image 165
Li Hanyuan Avatar answered Sep 30 '22 11:09

Li Hanyuan