ewooycom
ewooycom

Reputation: 2721

Soundcloud CORS

Soundcloud api should support cors as I read in documentation (http://developers.soundcloud.com/docs/api/guide#crossdomain).

But I think this is not the case:

XMLHttpRequest cannot load http://ec-media.soundcloud.com/fxguEjG4ax6B.128.mp3?longurldata... Cannot make any requests from null.

What am I doing wrong? I'm trying to play stream with aurora.js + mp3.js.

Upvotes: 3

Views: 2005

Answers (2)

Misha Reyzlin
Misha Reyzlin

Reputation: 13896

Unfortunately, at the moment, the CORS headers aren't enabled on the mp3 files that are delivered from the CDN (ec-media subdomain). You'd need to use a proxy if you need to request these files via XHR.

CORS headers are enabled on the JSON data returned from the API, but not the mp3s.

If you are trying to use Web Audio API you could use mediaElementSource and load the mp3 via setting src property of the audio to be used as “media source” as described here.

Upvotes: 1

T.J. Crowder
T.J. Crowder

Reputation: 1074168

Supporting CORS isn't an all-or-nothing, the server end chooses to support specific origins (and headers, and methods).

In your case, you appear to be making the call from a local file (origin null), e.g. an HTML document you've loaded via double-clicking from the file system or similar. Apparently they don't allow that.

Upvotes: 2

Related Questions