简体   繁体   English

我可以使用Spotify API收听事件,例如歌曲结尾吗?

[英]Can I listen for events, like a song ending, with the Spotify API?

Can I listen for events, like a song ending, with the Spotify API? 我可以使用Spotify API收听事件,例如歌曲结尾吗?

If so, how? 如果是这样,怎么办?

Thanks! 谢谢!

Yes. 是。

Add an observer for models.EVENT.CHANGE on the player object. 在播放器对象上添加models.EVENT.CHANGE的观察器。 When this fires, check that playing is false . 当这种情况发生时,请检查播放是否为false The song has ended if the position of the player object is the length of the playing track, or if the playing track is null . 如果播放器对象的位置是播放轨道的长度,或者播放轨道为null ,则歌曲已结束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM