如何从 SONOS 控制器向音乐服务发送心跳 (ping)

How to send heart beat (ping) to music service from SONOS controller

我只想知道我的服务中的音乐当前是否正在播放?通常对于我们的 Android 或 iOS 客户端,我们过去常常向服务发送心跳 (ping) 以通知客户端处于活动状态,如何在 SONOS 中实现相同的功能。我已经通过设置 pollinterval 尝试使用 getLastUpdate,但似乎只有当我的控制器在前台时它才会被调用。

提前致谢。

我们有多种报告方法可以帮助您完成此类报告。 reportPlaySeconds (http://musicpartners.sonos.com/node/388) is probably your best bet, as it will tell you how long a listener was listening to a track (and thus that playback is occurring) and allow you to set the interval at which this is reported back to you. In the future, reportPlayStatus (http://musicpartners.sonos.com/node/389) 也应该能够帮助您跟踪播放(尽管目前这仅报告跳过事件)。