Player Controls for iTunes & Youtube (including slider widget for scrolling through track)



I have created this preset because I wanted a slider widget that let's you scroll through the currently playing track. I have added a few other features, too. Some I have made myself and some I have found here. The preset is working with iTunes and Youtube (only in Safari). From what I can tell it should be possible to change the widgets a little so they work with e.g. Spotify or Youtube in other browsers.

In your main Touch Bar, a Youtube and/or iTunes "Now Playing"-widget is visible in your main container, depending on what is currently running. When pressing it, a button group with player controls opens. When long pressing it, Youtube/iTunes opens.

You have to allow JavaScript from Apple Events in Safari in order for the Youtube controls to work. Activate the developer menu in your Safari settings and activate the corresponding option there.


Functionalities: play, pause, skip (previous, next), show current position and length of track, scroll through track (player progress), show track info/name
Functionalities (only iTunes): love, dislike, toggle shuffle mode, toggle repeat mode
All controls only have effect on the respective player, so they do not use the system-wide controls for e.g. play/pause.

This preset needs some improvements to become perfect, e.g.:

  • iTunes widget is not showing the album cover (I tried to use code from here but didn't get it to work)
  • iTunes is often instantly reopening after quitting it when the iTunes widgets are active. I am not completely sure why
  • when there is more than one Youtube tab in Safari, the widgets are not always getting their data from the right one

Do tell me in case you add one of these functionalities or make other improvements to the preset. Also I want to do the same widgets for Netflix but haven't found a way to properly control the Netflix player with Javascript yet.

Thanks to GoldenChaos by @GoldenChaos and Touch Bar Done Right by @iAmWaldo , from which I have copied some widgets/code

In case you are looking for a slider widget for Spotify, you should be able to find it here: bensonderskov - Minimalist TouchBar preset with Spotify integration (scrub-bar, now playing, etc.)

Scrubbing bar widget in BTT
bensonderskov - Minimalist TouchBar preset with Spotify integration (scrub-bar, now playing, etc.)


Pretty nice setup you got there!
I had actually thought of making a slider for youtube before but I am not entirely satisfied with the way it looks in btt (i am a big fan of the look of the default one from apple :stuck_out_tongue: ) so I never really tried haha

In order to avoid itunes restarting over and over again, try adding a "try" fuction just between your "if application "itunes" is running" and "tell application "itunes" " it doesn't really make sense as the "if app" should not restart the app as it is not running, but the "try" function should fix that (i had a similar issue with spotify).

For the rest, I don't use iTunes so I don't really know how to fix the other issues

I'll try to link into the Netflix slide if I get a chance :wink:

Keep up the good work !


Thanks! I also prefer the native slider design, but I think the BTT one looks ok too. Thanks for the hint regarding iTunes closing, I'll try that. And let me know if you're successful with the netflix one.