Changes

no edit summary
Line 1: Line 1: −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">The Music/Sound Playing trigger fires when music or sound playback is started or stopped on the device. This allows you to automate actions based on audio playback state, such as adjusting volume or launching related apps.</pre>
Will fire when music or sound playback is started or stopped.
+
 
</pre>
+
''' Options '''
 +
 
 +
* '''Music or Sound Started''' - Fires when audio playback begins on the device
 +
* '''Music or Sound Stopped''' - Fires when audio playback stops on the device
 +
 
 +
''' Examples '''
 +
 
 +
''Example 1: Increase volume when music starts playing''
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Music/Sound Playing: Music or Sound Started</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Set Volume: Media Volume 80%</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Headphones: Plugged In</pre>
 +
 
 +
''Example 2: Turn off Bluetooth speaker when music stops''
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Music/Sound Playing: Music or Sound Stopped</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Wait 5 minutes
 +
Disable Bluetooth</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Music Playing: Not Playing
 +
Bluetooth: Connected to Bluetooth Speaker</pre>
 +
 
 +
''' Notes '''
 +
 
 +
* This trigger uses a background service (DetectMusicService) to monitor audio playback state
 +
* The trigger detects audio from any app that uses the standard Android audio system
 +
* "Music or Sound" includes any audio stream, not just music (e.g., podcasts, videos, games)
 +
* The trigger fires when the audio focus state changes, which may not exactly match when you hear sound start or stop
 +
 
 +
''' See Also '''
 +
 
 +
* [[Constraint:_Music_Active|Music Active Constraint]]
 +
* [[Action: Control Media]]
 +
* [[Trigger: Media Button Pressed]]