Enable Picture in Picture Mode for YouTube (PIP)

With the new iOS 14 update, you can allow movies, videos and TV shows to be watched in picture in picture mode which is a small window without leaving the active tasks on your iPhone or iPad. Many applications like Hotstar, Netflix etc supports this PIP feature.

youtube picture in picture pip


Sadly, for now this support is not yet available to YouTube application but you can still take the advantage of YouTube Picture in Picture mode on iPhone or iPad through Safari web browser by creating a simple shortcut. Let me show you how.

YouTube Picture in Picture (PIP) Mode on iPhone/iPad

  1. First of all, launch the Shortcuts application on your iPhone then tap on this + icon to create a new shortcut.
  2. Now choose ‘Add action’ then ‘Web’ and then ‘Run JavaScript on Web Page
  3. Now tap on ‘Web page’ label then select ‘Shortcut Input’ in the pop-up menu.
  4. Here you must remove the existing code and copy and paste the following code.
    let v = document.querySelector('video');
    v.addEventListener('webkitpresentationmodechanged', (e)=>e.stopPropagation(), true);
    setTimeout(()=>v.webkitSetPresentationMode('picture-in-picture'), 3000);
  5. Now tap on these three dots then name your Shortcut. I’m naming it as Y PIP.
  6. Now, enable ‘Show in Share Sheet’ then tap on ‘Share Sheet Types’, choose ‘Deselect All’ then select only ‘Safari web pages’.
  7. Come back to the details screen then choose ‘Done’ and again confirm the shortcut by choosing ‘Done’ again.
  8. Now open YouTube on Safari web browser then pick your favorite video. Tap the share icon and here choose the created shortcut for the YouTube Picture in Picture mode on iPhone or iPad. For the first time, you need to allow the script to run on Safari.
  9. Finally, refresh or relaunch the browser then choose the YouTube video the tap on Action icon and here select the created shortcut.

That’s it. You can now move the YouTube PIP window anywhere on the screen and can do other things on the iPhone or iPad.

Leave a Comment