macos – Simple AppleScript to send media keys to a program, works for spotify and not other players, any way to identify the correct variable/fix?


MacOS, I’m trying to use a keyboard macro program called keyboard maestro that can send media keys to programs using AppleScript. It works on Spotify

tell application "spotify"
playpause
end tell
    

but if I try it on another obscure media player I want, or Google chrome to control youtube videos/youtube music

tell application "Headset"
playpause
end tell
    

or

tell application "Google Chrome"
playpause
end tell
     

They give macro failed errors with this in the log

2020-09-09 21:30:25 Execute an AppleScript failed with script error: text-script:25:38: execution error: The variable playpause is not defined. (-2753)

Media keys pressed from the keyboard do work on them, is there a way to find which commands will work on them to simulate the keys or they just don’t accept them this way via AppleScript?