Soundcloud CORS

扫码查看
本文介绍了Soundcloud CORS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Soundcloud api应支持我在文档中阅读的内容()。

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

但我认为不是这样:

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

我做错了什么?我试图用aurora.js + mp3.js播放流。

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

推荐答案

不幸的是,在从CDN( ec-media 子域)传递的mp3文件上未启用。如果您需要通过XHR请求这些文件,您需要使用代理。

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.

在API返回的JSON数据上启用了CORS标头,而不是mp3。

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

如果您尝试使用Web Audio API,您可以使用 mediaElementSource ,并通过 src 的音频属性(如所述)。 。

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.

这篇关于Soundcloud CORS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 16:43
查看更多