As we all know, YouTube picture-in-picture mode cannot be used on Android and iOS devices. Apple released the long-awaited picture-in-picture mode on the iPhone running iOS 14. Thanks to the new function of playing videos in PiP, users can also reduce the size of the video and play it in a floating window. However, some users reported that the “Picture in Picture” feature of the iPhone is not available for YouTube. So, in this guide, you will learn the easiest way to create or add YouTube PiP shortcut on Safari for iPhone iOS 14, and also you’ll learn how to use it.
YouTube Premium membership unlocks many additional features. Context playback is one of the functions used. Essentially, it encourages you to play the video in the background while you perform other operations on your mobile device. Although this is excellent for music playback, if you want to watch a movie, you should use the “Picture in picture” mode.
In the latest iOS 14 update, Apple added a picture-in-picture option to the iPhone. Although this feature can be used to make video calls on WhatsApp and Facetime, it is not yet available for video streaming in the YouTube app. However, there is a solution.
Related: How to Enable Picture-in-Picture on Android
Create and Add YouTube PiP Shortcut on Safari for iPhone iOS 14
Thanks to CodeEverywhere, there is now a new solution that suppresses the “picture-in-picture” block that YouTube brings to its mobile platform, which uses a JavaScript code snippet that requires no additional plug-ins.
According to CodeEverywhere, if you want to view videos hosted by YouTube as a picture-in-picture, you can also include the same code in the iOS shortcut selected in the “Activity” view of Safari (formerly known as the “Share Sheet”).
Here’s how to create and add YouTube PiP shortcut on your iPhone:
- Go to the Shortcuts app on your iPhone and click on the “+” icon at the top right-hand corner.
- Select Add Action.
- Tap on Web.
- Under “Safari,” tap on Run JavaScript on Web Page.
- Click the blue words Web Page, then choose Shortcut Input in the pop-up menu.
- Remove the existing JavaScript code in the shortcut window and paste in the below code and then click on Next.
let v = document.querySelector('video');
v.addEventListener('webkitpresentationmodechanged', (e)=>e.stopPropagation(), true);
setTimeout(()=>v.webkitSetPresentationMode('picture-in-picture'), 3000);
completion()
- Choose for the shortcut a name and tap Done.
- Click on the three dots icon in the top-right corner of the screen and also on the next page.
- Turn on Show in Share Sheet, and click on the Share Sheet Types, then tap on Deselect All and select Safari web pages.
- Go back to the Details screen, then click Done twice.
How to Use iOS 14’s picture-in-picture mode to watch YouTube videos on Safari
- Launch the Safari web browser and open YouTube.
- Play any video you want in YouTube video and then click on the share icon.
- Tap on the YouTube PiP shortcut that we created before, tap on Allow.
- Now, you can enjoy the PiP mode on your iPhone on iOS 14.
The YouTube video will start playing in floating picture-in-picture mode in iOS 14 until you click on it. You can also adjust the video playback speed and resolution on the mini player from here.
To continue using picture-in-picture mode, press the Home button or swipe up to the iPhone home screen instead of pressing close. You can move the small player window, as usual, use the shortcut search, and play and pause videos.
This is how you can easily create and add YouTube PiP shortcut on Safari for iPhone iOS 14, and also how to use picture-in-picture mode to watch videos on Youtube.
Read more:
Hi, can you update the tutorial for iOS 16, please?
soon, we will. Thank you!