订阅Spotify活动 [英] Subscribe to Spotify events

查看:120
本文介绍了订阅Spotify活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何订阅Spotify应用程序中的事件?要订阅iTunes事件,您只需向通知中心添加一个观察者,如下所示:

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.playerInfoobject:nil];

发送 NSNotification changedTrack:

看起来找不到类似(或任何方式)为Spotify做这个,但我知道有应用程序这样做,例如应用程序显示当前正在播放的歌曲。

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.

推荐答案

Spotify的 NSDistributedNotification 名称是 com.spotify.client.PlaybackStateChanged

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

使用 NSDistributedNotificationCenter 订阅,您会收到类似iTunes的通知。

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

这篇关于订阅Spotify活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆