Difference between revisions of "Trigger: Spotify"

 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
===<p><b>When is this trigger activated?</b></p>===
+
<pre class="header-style">This trigger will fire when various Spotify events occur. In order for this trigger to function, you must enable the "Device Broadcast Status" option within the Spotify app's settings page.</pre>
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''' Options '''
Triggered when Spotify events occur.</pre>
 
  
===<p><b>Magic Text</b></p>===
+
* '''Playback Started''' - The trigger fires when music playback begins in Spotify
 +
* '''Playback Stopped''' - The trigger fires when music playback stops or is paused in Spotify
 +
* '''Song Changed''' - The trigger fires when the currently playing track changes
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''' Requirements '''
This action supports the use of magic text, you can use extracting it from some previously defined variable, using the (...) button.
 
</pre>
 
* ''When this trigger is present, you can use more [...]'' ''[https://macrodroidforum.com/wiki/index.php/Magic_text#Spotify magic text]''
 
  
===<p><b>Supported configurations</b></p>===
+
* Spotify app must be installed
 +
* "Device Broadcast Status" must be enabled in Spotify app settings
  
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
''' Enabling Device Broadcast Status '''
Playback started - Starts when spotify starts playing.
+
 
</pre>
+
To enable broadcasting in Spotify:
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
# Open the Spotify app
Playback stopped - Starts when Spotify pauses or stops playback.
+
# Go to Settings (gear icon)
</pre>
+
# Scroll down to find "Device Broadcast Status"
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
# Enable the option
Song changed - Starts when any playback changes.
+
 
</pre>
+
Without this setting enabled, the trigger will not receive any events from Spotify.
 +
 
 +
''' Magic Text Variables '''
 +
 
 +
When this trigger fires, Spotify-specific Magic Text values is available:
 +
 
 +
{spotify_track_id}, {spotify_artist}, {spotify_album}, {spotify_track}, {spotify_track_length_s}, {spotify_is_playing}
 +
 
 +
''' Examples '''
 +
 
 +
'''Example 1: Music mode'''
 +
 
 +
Enable music-friendly settings when Spotify starts playing:
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Spotify: Playback Started</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Media Volume: 70%
 +
Do Not Disturb: Enable (Allow media sounds)
 +
Display Notification: "Spotify playing - DND enabled"</pre>
 +
 
 +
'''Example 2: Restore settings on stop'''
 +
 
 +
Restore normal settings when music stops:
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Spotify: Playback Stopped</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Do Not Disturb: Disable
 +
Media Volume: 50%</pre>
 +
 
 +
'''Example 3: Track change logging'''
 +
 
 +
Show current artist and track as floating text:
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Spotify: Song Changed</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Floating Text: "{spotify-artist} - {spotify_track}"</pre>
 +
 
 +
''' Notes '''
 +
 
 +
* If Spotify is not installed, a warning will be displayed when configuring this trigger with a link to install it
 +
* The trigger listens for Spotify-specific broadcast intents: playbackstatechanged, metadatachanged, and queuechanged
 +
* The "Device Broadcast Status" setting in Spotify controls whether these broadcasts are sent
 +
* This trigger only works with the official Spotify app, not Spotify Lite or web player
 +
* Some metadata may not be available depending on Spotify's current broadcast implementation
 +
 
 +
''' See Also '''
 +
 
 +
* [[Trigger:_Media_Button_Pressed|Media Button Pressed]]
 +
* [[Action:_Control_Media|Control Media Action]]
 +
* [[Constraint:_Music_Active|Music Active Constraint]]

Latest revision as of 20:22, 7 January 2026

This trigger will fire when various Spotify events occur. In order for this trigger to function, you must enable the "Device Broadcast Status" option within the Spotify app's settings page.

Options

  • Playback Started - The trigger fires when music playback begins in Spotify
  • Playback Stopped - The trigger fires when music playback stops or is paused in Spotify
  • Song Changed - The trigger fires when the currently playing track changes

Requirements

  • Spotify app must be installed
  • "Device Broadcast Status" must be enabled in Spotify app settings

Enabling Device Broadcast Status

To enable broadcasting in Spotify:

  1. Open the Spotify app
  2. Go to Settings (gear icon)
  3. Scroll down to find "Device Broadcast Status"
  4. Enable the option

Without this setting enabled, the trigger will not receive any events from Spotify.

Magic Text Variables

When this trigger fires, Spotify-specific Magic Text values is available:

{spotify_track_id}, {spotify_artist}, {spotify_album}, {spotify_track}, {spotify_track_length_s}, {spotify_is_playing}

Examples

Example 1: Music mode

Enable music-friendly settings when Spotify starts playing:

Triggers

Spotify: Playback Started
Actions

Media Volume: 70%
Do Not Disturb: Enable (Allow media sounds)
Display Notification: "Spotify playing - DND enabled"

Example 2: Restore settings on stop

Restore normal settings when music stops:

Triggers

Spotify: Playback Stopped
Actions

Do Not Disturb: Disable
Media Volume: 50%

Example 3: Track change logging

Show current artist and track as floating text:

Triggers

Spotify: Song Changed
Actions

Floating Text: "{spotify-artist} - {spotify_track}"

Notes

  • If Spotify is not installed, a warning will be displayed when configuring this trigger with a link to install it
  • The trigger listens for Spotify-specific broadcast intents: playbackstatechanged, metadatachanged, and queuechanged
  • The "Device Broadcast Status" setting in Spotify controls whether these broadcasts are sent
  • This trigger only works with the official Spotify app, not Spotify Lite or web player
  • Some metadata may not be available depending on Spotify's current broadcast implementation

See Also