Let me break this down for you. Im working with Django 1.4 (so, obviously with Python too, which would be v2.7.1). In SoundClouds Developer docs, its says you can embed the player with the following code – given that you’ve registered your app & downloaded the SDK (which I’ve done):
import soundcloud
# create a client object with your app credentials
client = soundcloud.Client(client_id='YOUR_CLIENT_ID')
# get a tracks oembed data
track_url = 'http://soundcloud.com/forss/flickermood'
embed_info = client.get('/oembed', url=track_url)
# render the html for the player widget
return render_template('player.html', widget=embed_info['html'])
So my question is where this render_template coming from? I get an error in Django saying render_template is not defined. Is that the same as the render_to_response in django? I’m not sure what’s what here. Thanks.
[EDIT] The SoundClouds developers documentation: http://developers.soundcloud.com/docs#playing
After thinking it through, I assume render_template is just a placeholder call to whatever your favorite rendering tool is.
I assume embed_info[‘html’] contains the full HTML code to embed the widget in your page, so try printing it and see if it looks right. Then pick whatever templating language you want, and pass this variable to it as a widget to embed.