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

血红的双手。 提交于 2021-01-28 07:05:03

问题


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

If so, how?

Thanks!


回答1:


Yes.

Add an observer for models.EVENT.CHANGE on the player object. When this fires, check that playing is 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.



来源:https://stackoverflow.com/questions/9328890/can-i-listen-for-events-like-a-song-ending-with-the-spotify-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!