It's pretty easy to get Picture in Picture (PiP) in Safari on macOS - just a right-click twice - and if that didn't work, I described simple workaround by disabling JavaScript. Here I have a Workflow.is App based workaround to enable PiP in YouTube in Safari on iOS. This allows me to surf (or work) while having a video running in a tiny floating window on my iPad.

Here's what I did, based on the idea I got from a Reddit post on this same topic. Although I think my method below is a little better, otherwise I would not bother to post it! :)

Create a new Workflow, of type Action Extension and give it a name, e.g. PiP and select Accepts URLs.

The workflow should contain:

  1. Start off with Get Component of URL to grab the YouTube Query, e.g. https://m.youtube.com/watch?v=abcd will return v=abcd (the part of the URL after the ? is called the "query string" and it is a specific parameter passed to YouTube, in this case, the ID of the video).
  2. Then add Get Dictionary from Input which will convert the query string into a Workflow Dictionary.
  3. Get the value of the key v with Get Dictionary Value, i.e. just the abcd portion in the example.
  4. And the re-construct the URL as www.youtube-nocookie.com/embed/[[Dictionary Value]] where [[Dictionary Value]] is the Magic Variable output from the previous step.
  5. Finally, Open URLs

Workflow for youtube.com Action Extension

Updated 28 March: Reader Solomin DG reported that opening a Youtube video in Safari via Workflow Extension simply launches the Youtube App! This seems to happen periodically on my device too. I haven't tested, but methinks adding ?noapp=1 or ?app=desktop may work, i.e. www.youtube-nocookie.com/embed/[[Dictionary Value]]?noapp=1

YouTube PiP in Safari

To use the workflow, open Safari, and navigate to a YouTube video:

  1. Tap the Share icon.
  2. In the last row, scroll till you find Run Workflow and click it.
  3. A Run Workflow dialog will appear, and tap on the workflow created above, e.g. PiP.
  4. Now, the YouTube video will open in a full tab. Press Play
  5. Once the video is playing, press the Safari PiP icon in the bottom left, and the video pop out in a floating window. Note that you can't close the Safari tab which says "This video is playing in Picture in Picture".

Note: If you don't find the Run Workflow icon in step 3 above, then:

  • Scroll the last row as far as it'll go to the right and tap on More,
  • In the Activities list, enable Run Workflow,
  • Hit Done, and then return to step 3 above.

YouTube app

Using the YouTube app, if you tap the Share icon, then Copy Link, you'll get the YouTube URL in the form https://youtu.be/abcd.

This means the workflow needs to be slightly different, and to support both URL forms in the Workflow, you could check If the input Contains youtu.be instead.

So, the workflow is now:

  1. Right at the top, insert If Contains youtu.be, then:
    1. Add Replace Text to Find Text youtu.be and Replace With www.youtube-nocookie.com/embed
    2. End it with Open URLs
  2. Under the Otherwise section:
    • (The same as above for youtube.com)

Workflow for youtu.be Action Extension

The steps to get PiP from the YouTube App are pretty similar:

  1. Tap Share scroll to the right and tap More.
  2. Hit Run Workflow.
  3. Then select Workflow created e.g. PiP.
  4. As above, Safari will open the video in a tab, so hit Play
  5. And then hit the Safari PiP icon.

Conclusion

That's how to workaround YouTube's restriction on PiP. An extra five taps just to get it playing, and one extra tap to close the playing tab. This is still quite a lengthy workaround but it's as efficient as I can get it.

If you have a better way, drop me a note!

Updated 28 May: With thanks to reader Solomin DG: Opening a Youtube video in Safari via Workflow Extension simply launches the Youtube App! This may be Safari's behaviour now, and I mention a couple of potential workarounds that I have not tested... Also, I'm not even sure if Google has removed the URL I used.