kirtan-shah / nowplaying-cli

macOS command-line utility for retrieving currently playing media
GNU General Public License v3.0
148 stars 9 forks source link

Reading play/pause status? #3

Closed zcag closed 1 year ago

zcag commented 1 year ago

Is there a possibility with this tool?

kirtan-shah commented 1 year ago

I don't think this is possible with the current APIs. At first I wanted to read play/pause status in order to implement the functionality of "if something is playing, then pause it." But this functionality can be implemented with nowplaying-cli pause because pausing already paused content does nothing.

zcag commented 1 year ago

Thanks a lot for the answer. My main use case was that i wanted to show current media playing on my status only when it's played and not paused. Or maybe just put a play/pause icon, but yeah.

frypf commented 1 year ago

Sorry for weighing in on another closed issue, but it struck me that you maybe could check whether kMRMediaRemoteNowPlayingInfoPlaybackRate > 0 for this?

kirtan-shah commented 1 year ago

Good idea, it seems like the behavior is dependent on the app though. Spotify gives me 1/null when play/pause but youtube on firefox stays stuck at 1 whether play/pause. Probably best left to the user to interpret