Matthew Sullivan

Posts Projects About

Picture in Picture on your Mac without Safari

August 14, 2017

I really love the Picture in Picture feature that Apple offers on Macs. I don’t love that you need to use Safari to use it for Youtube. I recently found some tools that allow you to use it fairly easily without Safari.

I primarily use this to play videos in the corner of my monitor while I’m working for background noise. Eventually, I hope to also wrap this in a script to easily let me watch a playlist without manually grabbing the video ID each time.

Requirements

First step is to install Node.js, ytdl, and open-pip-cli. The README of open-pip-cli is where I got this fun hack.

Note: You’ll need macOS Sierra (10.12) or above.

Bash Shortcut

Next step is to add a shortcut to our ~/.bash_profile so we can use this command easily. After adding this, make sure to run the command source ~/.bash_profile so you can use the command you just added.

# youtube
function yt () {
  ytdl --print-url --filter-container=mp4 $1 | open-pip
}

Usage

Now all that’s left is to use our shiny new toy. Find the ID of video you want to watch on Youtube and copy the it from the browser address bar.

The url follows this format: https://www.youtube.com/watch?v={{ VIDEO_ID }}

Finally, paste that into the command below and you should have a video pane pop up with the video you provided.

$ yt {{ VIDEO_ID }}

Bonus

If you read the README of open-pip-cli you’ll also see that you can use it to watch Twitch streams. Now you can be even less productive.

My name is Matthew Sullivan. Currently, I'm a Senior Software Engineer at Target in Minneapolis, MN. Previously I was a Senior Software Engineer at Star Tribune, Lead Web Engineer at Botlink, and the CEO & co-founder of Jumpr.