No internet connection
  1. Home
  2. How to

Apple Music Transport Controls

By @pepsin
    2023-02-15 17:04:48.147Z

    Is it possible to set up a macro that will trigger system play/pause, previous/rewind, and next/fast forward buttons on a Streamdeck like the native Mac Streamdeck app? Using their interface, pressing a previous/next button skips to the appropriate track while holding activates a fast forward or rewind state. I'd love to recreate this functionality if possible.

    Thanks for your time!

    • 2 replies
    1. Chris Shaw @Chris_Shaw2023-02-15 19:02:21.391Z2023-02-15 20:03:19.186Z

      At the moment I can't figure out how to simulate the music control keys on a Mac's keyboard which would make these scripts work with other music apps but you can control Apple Music with simple AppleScript commands.
      This script will play/pause Music. Just duplicate the script and replace playpuase with the other commands listed in the comments

      sf.system.execAppleScript({
          script:`tell application "Music" to playpause`
      })
      
      /* for other functions just replace `playpause`with any of the following commands:
      stop
      pause
      play
      play next track
      play previous track
      */
      

      for other function like controlling the volume etc check out this article - just be sure to use "Music" in the commands instead of "iTunes"
      https://alvinalexander.com/apple/itunes-applescript-examples-scripts-mac-reference/

      1. P
        In reply topepsin:
        @pepsin
          2023-02-15 19:22:20.596Z

          Thanks for the quick response, Chris! This works for me ☺️
          It seems like there's no way for Soundflow to differentiate between a button being pressed once vs. held down, is that correct?