Browse the docs

musicPlayerState

Returns the state of the Music app's player as text.

Keyboard Maestro: MusicPlayerState

Details #

musicPlayerState() takes no arguments and returns text. If the Music app isn't running it answers stopped without opening it. Otherwise it asks Music for its player state and returns what Music says, such as playing or paused.

Parameters #

Takes 0 arguments. {{ musicPlayerState() }}

Examples #

musicPlayerState() == "playing"
→ false
musicPlayerState()
→

Gotchas #

  • Calling it with an argument is an error: musicPlayerState() takes 0 arguments, got 1.

  • Asking a running Music app needs Automation permission for Music. If that fails or takes longer than three seconds the answer is stopped.

  • With nothing real to read (a fake system), the answer is empty text, not stopped.