Announcements
The Spotify Stars Program: Celebrating Values Week!

Help Wizard

Step 1

NEXT STEP

AppleScript volume doesn't sync correctly when switching devices

AppleScript volume doesn't sync correctly when switching devices

On Mac / Desktop, the volume will suddenly jump because volume seems to get cached incorrectly. Steps to reproduce:

 

1. Connect Spotify to an Amazon Echo device, start playing a song via desktop.

2. Set volume directly on Spotify desktop slider to 10%, so that Echo's volume is mirrored at 10%

3. Change device to play directly on "This computer"

4. Set volume directly on Spotify desktop slider to 50%

5. Change device back to Echo device. (Spotify's volume will sync to that of the Echo, so correctly jumps back down to 10%.)

6. Run the following simple AppleScript to increment Spotify's volume by 10%:

 

 

tell application "Spotify"
    set vol to get sound volume
    set sound volume to vol + 10
end tell

7. Unfortunately, the volume that the script receives is the old desktop volume (50%) rather than the current Amazon echo volume (10%), so it jumps up to 60% instead of 20%.

 

My use case is that I've set up Alfred shortcuts to change Spotify's volume slider so that I can directly change the volume of Spotify no matter whether I'm listening through my headphones on my computer or through my Amazon Echo, which is super handy!

 

Reply
0 Replies

Suggested posts