小编Gra*_*d02的帖子

通过Soundmanager2播放SoundCloud链接

我在我的网站上使用Soundmanager Mp3按钮.但是,我想使用Soundcloud Api通过Soundmanager流式传输音轨,而不是托管MP3.基本上,我想通过Soundmanager按钮流式传输Soundcloud链接.可能?

我已经尝试创建一个jQuery循环(下面),但仍然没有运气.

<ol>
<li><a class="sm2_button" href="http://soundcloud.com/....">Track Title</a>
</li>
</ol>
Run Code Online (Sandbox Code Playgroud)

和jQuery

$("ol a").each(function()
    { 
        var thisLink = $(this);                         
        var track_url = this.href;                      // save href value of each link to 'track_url' i.e. soundcloud.com/...
        this.href = this.href.replace(track_url, "#");  // replace href value with '#'
        var consumer_key = 'My Consumer Key';
            // now resolve the stream_url through Soundcloud's getJSON method
        $.when($.getJSON('http://api.soundcloud.com/resolve?url=' + track_url + '&format=json&consumer_key=' + consumer_key + '&callback=?', function(track) {
            url = track.stream_url + '?consumer_key=' + consumer_key;   
            })).done(function() {
                // …
Run Code Online (Sandbox Code Playgroud)

soundmanager2 soundcloud

3
推荐指数
1
解决办法
2661
查看次数

标签 统计

soundcloud ×1

soundmanager2 ×1