Difference between revisions of "Trigger: Music/Sound playing"
| Line 1: | Line 1: | ||
| − | <pre | + | <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> |
| − | + | ||
| − | </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]] | ||
Latest revision as of 20:57, 6 January 2026
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.
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
Triggers Music/Sound Playing: Music or Sound Started
Actions Set Volume: Media Volume 80%
Constraints Headphones: Plugged In
Example 2: Turn off Bluetooth speaker when music stops
Triggers Music/Sound Playing: Music or Sound Stopped
Actions Wait 5 minutes Disable Bluetooth
Constraints Music Playing: Not Playing Bluetooth: Connected to Bluetooth Speaker
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