My question is identical to this one here, however as the question was never resolved and I can't message PeeHaa privately to ask the answer I'll ask again here.
I've successfully queried the soundcloud api and gotten my the stream_url for each track and added it to all the hrefs of my 360 player (demo here). My code for the elements looks something like this:
<div class="ui360">
<a href="/path/to/an.mp3" data-title="Track title">play "an.mp3"</a>
</div>
I have this script to find all the a tags with data-title attributes and give them the correct href based on the stream_url, but when I try to click the soundmanager icon in the browser and play the track, it just gets redirected to the .mp3 url.
SC.initialize({
client_id: 'MY_CLIENT_ID'
});
SC.get('/playlists/2450655', 'allow_redirects=False', function(playlist) {
var titles = $('.audio .ui360 a').each(function(index){
this.index = index;
});
for (var i = 0; i < playlist.tracks.length; i++) {
var id = '?client_id=MY_CLIENT_ID'
for (var j = 0; j < titles.length; j++) {
if (playlist.tracks[i].title === $(titles[j]).attr('data-title')) {
$(titles[j]).attr('href', playlist.tracks[i].stream_url+id)
}
}
}
});
Does anyone know how to get the correct url for playing tracks hosted on soundcloud in this manner?
I know this is an old question, but the problem was driving me up the wall and I finally figured it out, so here's my answer for others:
Soundmanager will work if you specify an mp3 mimetype in the link:
<div class="ui360">
<a type="audio/mp3" href="https://api.soundcloud.com/tracks/49349198/stream?client_id=YOUR_CLIENT_ID" data-title="Track title">play "an.mp3"</a>
</div>