按Soundcloud自定义播放器播放列表的顺序排序

时间:2012-08-30 20:44:25

标签: javascript jquery api soundcloud

我正在使用soundcloud自定义播放器来吸引收藏。我的问题是我如何按日期收取排序,而不是按上传日期这是最小演示中的默认值?

http://developers.soundcloud.com/docs/custom-player

我正在处理的脚本在这里:https://github.com/soundcloud/soundcloud-custom-player/blob/master/js/sc-player.js

在我的实现中,我使用:

构建了播放器
<div class="post faves">
<a href="http://soundcloud.com/mr-tunes/favorites" class="sc-player"></a>
</div>

1 个答案:

答案 0 :(得分:1)

Soundcloud不提供通过API对曲目进行排序的方法,只是为了过滤它们。 API不会为用户将曲目设置为收藏时提供参数。

默认情况下,它应该按照设置为收藏夹的时间排序,你可以通过将每个轨道添加到一个数组中并在其上运行array.reverse()来反转它。

按字母顺序排序或按API提供的任何其他参数排序,您可以使用相同的方法,将参数放入数组并使用.sort()和/或.reverse()