1
美好的一天。我使用SoundCloud,並且想要獲得現在播放的歌曲名稱。我可以使用JS或PHP來做到這一點。請幫我找到正確的例子。謝謝。如何找出在我的播放列表中使用SoundCloud API播放的歌曲?
美好的一天。我使用SoundCloud,並且想要獲得現在播放的歌曲名稱。我可以使用JS或PHP來做到這一點。請幫我找到正確的例子。謝謝。如何找出在我的播放列表中使用SoundCloud API播放的歌曲?
當您的曲目開始播放(收聽SC.Widget.Events.PLAY
事件)時,您可以使用getCurrentSound
方法。
var iframe = document.querySelector('#player');
var sc = SC.Widget(iframe);
// ...
sc.getCurrentSound(function(music){
console.log(music.title);
});
getCurrentSound
返回sound
對象,它具有一個title屬性。
相關文檔here。