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
The workflow should contain:
- Start off with Get Component of URL to grab the YouTube
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).
- Then add Get Dictionary from Input which will convert the query string into a Workflow Dictionary.
- Get the
valueof the key
vwith Get Dictionary Value, i.e. just the
abcdportion in the example.
- And the re-construct the URL as
[[Dictionary Value]]is the Magic Variable output from the previous step.
- Finally, Open URLs
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
?app=desktop may work, i.e.
YouTube PiP in Safari
To use the workflow, open Safari, and navigate to a YouTube video:
- Tap the Share icon.
- In the last row, scroll till you find Run Workflow and click it.
- A Run Workflow dialog will appear, and tap on the workflow created above, e.g.
- Now, the YouTube video will open in a full tab. Press Play
- 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.
Using the YouTube app, if you tap the Share icon, then Copy Link, you'll get the YouTube URL in the form
This means the workflow needs to be slightly different, and to support both URL forms in the Workflow, you could check If the input
So, the workflow is now:
- Right at the top, insert If
- Add Replace Text to Find Text
youtu.beand Replace With
- End it with Open URLs
- Add Replace Text to Find Text
- Under the Otherwise section:
- (The same as above for youtube.com)
The steps to get PiP from the YouTube App are pretty similar:
- Tap Share scroll to the right and tap More.
- Hit Run Workflow.
- Then select Workflow created e.g.
- As above, Safari will open the video in a tab, so hit Play
- And then hit the Safari PiP icon.
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.