| Line 1: |
Line 1: |
| − | ===<p><b>About</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.
| |
| | | | |
| − | In order for the Spotify trigger to function you must enable the 'Device Broadcast Status' option within the Spotify app's settings page.
| + | * '''Playback Started''' - The trigger fires when music playback begins in Spotify |
| − | </pre>
| + | * '''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 |
| | | | |
| − | ===<p><b>Magic Text</b></p>===
| + | ''' Requirements ''' |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | * Spotify app must be installed |
| − | This action supports the use of magic text, you can use extracting it from some previously defined variable, using the (...) button.
| + | * "Device Broadcast Status" must be enabled in Spotify app settings |
| − | </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>===
| + | ''' Enabling Device Broadcast Status ''' |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | To enable broadcasting in Spotify: |
| − | Playback started - Starts when spotify starts playing.
| + | # Open the Spotify app |
| − | </pre> | + | # Go to Settings (gear icon) |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> | + | # Scroll down to find "Device Broadcast Status" |
| − | Playback stopped - Starts when Spotify pauses or stops playback. | + | # Enable the option |
| − | </pre> | + | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> | + | Without this setting enabled, the trigger will not receive any events from Spotify. |
| − | Song changed - Starts when any playback changes. | + | |
| − | </pre> | + | ''' 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 |
| | + | * A static counter is maintained internally to optimize resource usage when multiple macros use this trigger |
| | + | |
| | + | ''' See Also ''' |
| | + | |
| | + | * [[Trigger:_Media_Button_Pressed|Media Button Pressed]] |
| | + | * [[Action:_Control_Media|Control Media Action]] |
| | + | * [[Constraint:_Music_Active|Music Active Constraint]] |