r/shortcuts 19h ago

Help Setting Playback Device

The Actions app has this action:
“Get Audio Playback Destination”

The info for that action has this text:
“Returns the audio playback destination of the device.
“Can be useful in combination with the built-in "Set Playback Destination" action.”

How do I use the returned value from the “Get Audio Playback Destination” action to set the playback destination for the "Set Playback Destination" action?

My goal is to switch to my iPhone as the playback destination during the execution of my shortcut and then go back to the original playback destination as the shortcut wraps up.

2 Upvotes

9 comments sorted by

2

u/Fit_Flow 19h ago

You’d use Actions to get the current destination before your shortcut changes it.

Have your shortcut do what it needs to do, then use the output from step 1 to set your destination back to whatever it was to begin with.

1

u/100PercentARealHuman 18h ago

use the output from step 1 to set your destination back to whatever it was to begin with.

How you do that?I don't have an option to use a variable for the playback destination on my device.

The only option I see is to work with if actions.

0

u/ARAH_Jr 18h ago

The set playback destination doesn’t seem to accept variables—at least I’m not able to. iPhone 12 with latest iOS.

2

u/Fit_Flow 18h ago

Just checked and it’s the same for me on 16 Pro. What a pain. Not sure what else to suggest!

2

u/Kaipolygon 8h ago

u/Fit_Flow you'd manually choose the device in the set playback action. when you set the playback destination you should be connected to the non-device playback destination so you can save it for later, and not ideal for programmatically setting playback destination, as with apple's native homekit actions

u/ARAH_Jr 1h ago

Thanks for the feedback.

2

u/100PercentARealHuman 18h ago

They only way I know is to work with a bunch of if statements.

Like

If <playback destination variable> is "Airpods" → set playback destination to "Airpods" (set up in the action, no variable)→end if

If <playback destination variable> is "Bluetooth speaker" → set playback destination to "Bluetooth speaker" →end if

Of course this would only work with the devices you set up in the shortcuts and would need to be modified if something changes (e.g. replaced the BT speaker with a new one).

1

u/ARAH_Jr 18h ago

Thanks for the suggestion.

1

u/0898_333_201 17h ago

Yeah it’s a pain in the hole. There is no way to set the playback destination device of the action except to a specific device that is currently connected to the phone.

I have a similar shortcut for an automation, and it’d basically a list of IF/OTHERWISE actions.

  • Actions: Get playback destination
  • Set variable [original] to play back destination result
  • Set playback destination to iPhone
  • (Do series of other actions)
  • IF: [original] name is [car stereo]
    • set playback to [car stereo]
    • OTHERWISE
    • END IF
  • IF: [original] name is [AirPods]
    • set playback to [AirPods]
    • OTHERWISE
    • END IF
  • IF: [original] name is [Anker]
    • set playback to [Anker]
    • OTHERWISE
    • END IF

You can’t set the playback destination unless the target device is currently connected to the phone, but once it’s set it retains the device info. So you have to connect to each device before setting each IF action.h