Subscribe to Spotify events

2019-07-25 20:22发布

Does anyone know of a way to subscribe to events in the Spotify application? To subscribe to iTunes events, you would just add an observer to the notification center like this:

[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(changedTrack:) name:@"com.apple.iTunes.playerInfo" object:nil];

Thereby all events will be send in an NSNotification to changedTrack:.

I can't seem to find a similar (or any way) to do this for Spotify but I know there are applications doing this, for example applications showing the song currently being played.

1条回答
Bombasti
2楼-- · 2019-07-25 21:00

Spotify's NSDistributedNotification name is com.spotify.client.PlaybackStateChanged.

Subscribe to that using NSDistributedNotificationCenter and you'll get a notification very similar to iTunes'.

查看更多
登录 后发表回答