
The activation of Picture-in-Picture mode in iOS 14 has been blocked by Google on the mobile and desktop versions of YouTube from Safari. However, it can still be activated using a script launched in Apple’s Shortcuts application.
IOS 14 and Google users play cat and mouse. The new version of the iPhone operating system introduced a new feature, Picture in Picture, which allows users to watch videos in a remote window while using another application.
But Google has apparently not really appreciated the arrival of this function. If the Picture-in-Picture mode was functional on YouTube from mobile Safari, Google very quickly blocked the possibility of using the iOS function for free users of its platform. Indeed, the possibility of playing content in the background is in principle reserved for Premium subscribers of YouTube. But very quickly, users found a workaround to get around this restriction. By going through the desktop version of YouTube from mobile Safari, it was still possible to activate the Picture-in-Picture mode of iOS.
Google then tightened the screw a little more and proceeded to block the PiP from the desktop version of YouTube when the site is opened on Safari mobile. Never mind, users have more than one trick up their sleeve and have found a new twist to get around the blocking put in place by Google. Here’s how to continue enjoying iOS Picture-in-Picture mode on YouTube.
1. Download Shortcuts
If you haven’t already, download Apple’s Shortcuts app first. Offered for free, this very powerful application allows you to create automation scripts and multiply the uses of iOS. As proof, with iOS 14, many users have embarked on customizing the home screen of their iPhone using Shortcuts.
Download Shortcuts for iPhone (Free)
Read also: iOS 14: how to fully customize the interface of your iPhone?
2. Create a new Shortcut
Open the Shortcuts app on your iPhone and tap the + button displayed at the top right. Then tap Add action, then select Web.

In the list of actions displayed, locate the section dedicated to Safari and choose Run JavaScript on a web page. In the action displayed on your new shortcut, next to Run JavaScript on, tap Web page. Then select Shortcut Entry from the pop-up that appears on the screen.

3. Add the javascript code
Select all the javascript code displayed as an example in the action, delete it, and copy-paste the following javascript code:
let v = document.querySelector (‘video’);
v.addEventListener (‘webkitpresentationmodechanged’, (e) => e.stopPropagation (), true);
setTimeout (() => v.webkitSetPresentationMode (‘picture-in-picture’), 3000);
completion ()

Then press the Next button, give your shortcut a name, and save it by pressing the OK button.
4. Add the shortcut to the share sheet
From the Shortcuts home page, press the options button for your shortcut, represented by the three dots, and press the three dots inside the shortcut again.
Then activate the In the share sheet option, choose Deselect all and only select the Safari web pages option.
Then confirm by pressing OK twice to save your shortcut.

5. Activate picture-in-picture mode on YouTube
Then open Safari on your iPhone, go to YouTube and start playing a video. Press the share button, represented by a square from which an arrow escapes at the bottom of the screen, then in the share sheet, scroll through the options until you find your shortcut and press the one -this.

If it doesn’t appear, tap Edit actions to add it to the share sheet.
A pop-up asking if you want to allow the shortcut to access “Youtube.com” is displayed. Tap Allow to accept.

If everything went according to plan, the YouTube video played in Safari should display as Picture-in-Picture. You can then close Safari and use other apps on your iPhone while the video is playing.