kilokeith/soundcloud-soundmanager-player

How to retrieve album artwork for each song in playlist?

leatherboundbooks opened this issue · 8 comments

Also was curious how it would be possible to retrieve album artwork for each song?
*Additionally, is it possible to show each album cover along side each song in the playlist?
Thanks!

The returning SoundCloud object contains all of that data.
To see what the current track contains, try something like console.log( scplayer.track() );

You'll get back an object with the properties listed here:
http://developers.soundcloud.com/docs/api/reference#tracks

So you'd want the artwork_url property.

If you turning on preloading, then you could also grab that info from the cache by index. Example if from the included playlist example code.

scplayer.on("scplayer.init", function(e, track, sound){
    var playlist = scplayer.playlist();
    for(var x=0, l=playlist.length; x<l; x++){
        (function(x){
            //lookup the track info
            scplayer.track_info(x).done(function(track){
                console.log(track);
            });
        })(x);          
    }
});

When checking in Firebug's console, artwork_url returns null...
Or am I missing something, and your script above was just to help show what properties are available?

*Nevermind, I see its just showing what properties are available now...
Apologies, but Im still unclear on how I can use the artwork_url property to output each tracks artwork into my player.

Im admittedly better at php than I am at java/jquery currently.

If I can just pick your brain one last time on how to implement the use of artwork_url in your player I will be on my way... and THANK YOU for the help and the awesome player bro!

Best

You should be getting back a url to their image. So assuming you're using jQuery, you'd either set the src of an image or create a new one and append it in your DOM.

var track_info = scplayer.track();
$('img#artwork').attr('src', track_info.artwork_url);
//or
$('#artwork').append('<img src="'+track_info.artwork_url+'"/>');

Keith, first off this plugin is awesome. Thanks for integrating these two things! Exactly what my team was looking for.

I feel like this is a whole 'nother animal, but as far as adding the heart button from SoundCloud widget to the player... I realize that requires the user to be logged into SoundCloud, but is it possible with your plugin?

Just thought I'd ask! May be something we want to incorporate now, if possible, but soon down the road by whatever means...

Excellent player, though! I'm so impressed.

Glad you're enjoying it. This plugin is only capable of making public API
calls or accessing the single account that you provide consumer tokens for.
In order for users to be able to using their own account to "like" your SC
content, you'd need to implement an oAuth system or tie into some existing
SC widget to get their auth tokens to make requests on their behalf. That's
not something this plugin deals with and is way outside the scope of what
I'd include myself. At that point, I'd just suggest building a player on
top of their player widget.

On Saturday, August 24, 2013, denitto wrote:

Keith, first off this plugin is awesome. Thanks for integrating these two
things! Exactly what my team was looking for.

I feel like this is a whole 'nother animal, but as far as adding the heart
button from SoundCloud widget to the player... I realize that requires the
user to be logged into SoundCloud, but is it possible with your plugin?

Just thought I'd ask! May be something we want to incorporate now, if
possible, but soon down the road by whatever means...

Excellent player, though! I'm so impressed.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-23216950
.

Cool: that's what I figured. Question: is there currently a way to pass in new tracks or delete songs from the playlist using JS?

Oh, nevermind! I think I figured it out. 'add_tracks'. Thanks! ;)