Prevent song playing on URI link click

隐身守侯 提交于 2019-12-12 03:48:19

问题


I'm working on a Spotify app where I'd like for users to be able to click on track names and be linked to the track page, just like in other Spotify apps. I'd like to prevent the song from beginning playback, though.

SoundDrop seems to do this. You can click on a track name and the song doesn't interrupt playback by SoundDrop.

I'm not sure how to implement this alternative behavior. Any ideas?


回答1:


The Apps API uses standard JavaScript stuff, so if you attach a handler to the track link and use e.preventDefault(), that should prevent Spotify playing the track and you can then do your own custom handling.

More discussion on e.preventDefault() is here: event.preventDefault() vs. return false



来源:https://stackoverflow.com/questions/10492405/prevent-song-playing-on-uri-link-click

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