我可以使用 Spotify API 监听事件,例如歌曲结尾吗?
我可以使用 Spotify API 监听事件,例如歌曲结尾吗?
如果是这样,怎么办?
谢谢!
Can I listen for events, like a song ending, with the Spotify API?
If so, how?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。
在玩家对象上添加
models.EVENT.CHANGE
的观察者。当此事件触发时,检查playing 是否为false
。如果播放器对象的位置是播放曲目的长度,或者播放曲目为null
,则歌曲已结束。Yes.
Add an observer for
models.EVENT.CHANGE
on the player object. When this fires, check that playing isfalse
. The song has ended if the position of the player object is the length of the playing track, or if the playing track isnull
.