Mark Boulder
Mark Boulder

Reputation: 14277

Feature request: Making the API show profile thumbnails when there are no track thumbnails

THIS IS A FEATURE REQUEST FOR THE SOUNDCLOUD CREW (since they do not respond via [email protected])

Like SoundCloud itself, could the API show profile thumbnails when there are no track thumbnails available?

This way, when embedding SoundCloud tracks via Embedly or the like -- ie. http://jsbin.com/kezonutoroma/1/edit -- people won't have to be faced with those empty placeholder images.

https://soundcloud.com/oembed?url=https://soundcloud.com/liv-lykke/andres-haender&format=xml

<thumbnail-url>http://a1.sndcdn.com/images/fb_placeholder.png</thumbnail-url>

enter image description here

Should be:

<thumbnail-url>http://i1.sndcdn.com/avatars-000036988237-o1ck0r-t500x500.jpg</thumbnail-url>

enter image description here

Upvotes: 0

Views: 286

Answers (1)

hwsw
hwsw

Reputation: 2606

Here is a static, more hacky solution:

var defaultimg = 'http://i1.sndcdn.com/avatars-000036988237-o1ck0r-t500x500.jpg';

$('div a').embedly({
  key: '7c6cf67ad409446cacd53309d96b66a0',
  query: {
    maxwidth: 500,
    autoplay: true
  },
  display: function(data, elem){
    $(elem).html('<img src="'+defaultimg+'"/>');

    $(elem).addClass('play')
      .append('<span />')
      .width(data.thumbnail_width)
      .height(data.thumbnail_height)
      .find('span')
      .css('height', data.thumbnail_height)
      .css('width', data.thumbnail_width);
  }
}).on('click', function(){
  var data = $(this).data('embedly');
  $(this).replaceWith(data.html);
  return false;
});

http://jsbin.com/qovirepoyoto/1/edit

I would recommend to get the default image via an API call to the user endpoint.

Hope this helps you.

Upvotes: 1

Related Questions