Unfortunately, /oembed
only works for regular widget (HTML5 of flash) at the moment.
However, you can build the html for either of them yourself. Here's a template for tiny widget embed:
<object height="18" width="100%">
<param name="movie" value="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F{trackId}&player_type=tiny{widgetParams}"></param>
<param name="allowscriptaccess" value="always"></param>
<param name="wmode" value="transparent"></param>
<embed wmode="transparent" allowscriptaccess="always" height="18" width="100%" src="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F{trackId}&player_type=tiny{widgetParams}"></embed>
</object>
And the template for regular widget:
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F{trackId}{widgetParams}"></iframe>
You should put these into strings (without line breaks) and perform variable interpolation on these strings. I am not sure what language you are using, but most languages have this built in.
For JavaScript, which I'm writing most of the time, you could use Douglas Crockford’s supplant
function.
The variables are trackId
for which the value should be positive integer and widgetParams
, for which the value should be something like &color=ff6600&auto_play=false
, that is key=value
pairs prefixed with &
. I've used {
and }
as delimiters for variables to interpolate in my example, but it could, of course, be whatever your language or templates engine requires it to be.
For your client to be able to just give you a track URL, you'd need to do an API request to /resolve
endpoint to retrieve track ID from track URL (permalink). You'd need to register as a developer to have client_id
to authorise requests to the API. I've described how to do it in JavaScript in another answer here.
If you'd prefere not to do requests to the API, you could also ask your client to give you the embed code they can easily retrieve from any sound or set on SoundCloud by hitting "share" button, and then extract the sound or set ID using regular expression.
Here's an example of how this would work to insert a tiny widget (also using SoundCloud JS SDK) http://jsbin.com/OLUloX/1/edit