How to get the correct soundcloud url to embed from a standard url?

So, now I can grab the URL from the already embedded soundcloud files in the embed or iframe tags and use these URLs on another page and display them in fancybox. Is there a way to get the correct URL or display in fancybox if the user offers a typical sharing url like http://soundcloud.com/song-b/song-please or http://snd.sc/yp6VMo ? I tried to look at the api documentation, but I could not find what I was looking for.

+8
javascript php soundcloud
source share
4 answers

He is trying to get the html for creating the Soundcloud widget, and not getting the API URL for the track. oEmbed method "will serve as a widget embed code for any SoundCloud URL that points to a user, group, set or playlist", and it is recommended to make confident changes Soundclouds do not violate your application (as opposed to creating your own Flash object or iframe) . You can call it using a PHP web request on

 http://soundcloud.com/oembed?format=js&url=[escaped_url]&iframe=true 

Or using a JSON-P call (using jQuery for convenience)

 $.getJSON('http://soundcloud.com/oembed?callback=?', {format: 'js', url: 'http://snd.sc/yp6VMo', iframe: true}, function(data) { // Stick the html content returned in the object into the page $('#your_player_div').html(data['html']) } ) 

I add iframe = true so that you get the new HTML5 player, omitting to get the old Flash object. It also works with the short .sc URLs you use.

+17
source share

I'm not quite sure what you are asking here, but it looks like you might need an endpoint API solution. http://developers.soundcloud.com/docs/api/resolve

Example:

 $ curl -v 'http://api.soundcloud.com/resolve.json?url=http://soundcloud.com/matas/hobnotropic&client_id=YOUR_CLIENT_ID' HTTP/1.1 302 Moved Temporarily Location: http://api.soundcloud.com/tracks/49931.json 

This will give you all the information about the track, and that should be enough for everything you need. Also don't forget that there is an HTML5 widget .

+6
source share

you can try this for the song url and not for the song url id

  <iframe width="100%" height="166" scrolling="no" frameborder="no"src="http://w.soundcloud.com/player/?url=http://api.soundcloud.com/elissafranceschi/war&auto_play=false&color=915f33&theme_color=00FF00"></iframe> 
+6
source share

I have not tried this, changed the code here :

 <object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=<?php echo $url; ?>&amp;g=bb"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=<?php echo $url; ?>&amp;g=bb" type="application/x-shockwave-flash" width="100%"></embed> </object> <a href="<?php echo $url; ?>"><?php echo $url; ?></a> 
0
source share

All Articles