I am setting up a visualizer for Icecast, However I am getting the error
Failed to load resource: net::ERR_EMPTY_RESPONSE
On the Icecast config files I have included
<header name="Access-Control-Allow-Origin" value="*" />
<header name="Access-Control-Allow-Headers" value="Origin, Accept, X-Requested-With, Content-Type, If-Modified-Since" />
<header name="Access-Control-Allow-Methods" value="GET, OPTIONS, HEAD" />
Yet I continue to get the error.
I am using this to initiate the audio,
<audio id="myAudio" crossorigin='anonymous' src="http://127.0.0.1/radio.ogg"></audio>
I am using Visualizer (A JS Thing) to then do the backend work.
Visualizer.prototype.loadSound = function () {
var req = new XMLHttpRequest();
req.setRequestHeader("crossorigin", "anonymous");
req.open('GET', this.audioSrc, true);
req.responseType = 'arraybuffer';
this.canvasCtx.fillText('Loading...', this.canvas.width / 2 + 10, this.canvas.height / 2);
req.onload = function () {
this.ctx.decodeAudioData(req.response, this.playSound.bind(this), this.onError.bind(this));
}.bind(this);
req.send();
};
However still returning the error even though I have enabled it.
The response I am getting from Headers is
HTTP/1.0 400 Bad Request
Server: Icecast 2.4.2
Date: Sat, 27 Aug 2016 16:16:19 GMT
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type, If
-Modified-Since
Access-Control-Allow-Methods: GET, OPTIONS, HEAD
<html><head><title>Error 400</title></head><body><b>400 - unknown request</b></b
ody></html>
I am trying to make a Audio Visualizer for a live radio station. However having troubles due to the Access-Control even though I have set the headers inside the settings.
The script in question: http://www.cssscript.com/minimal-audio-visualizer-with-canvas-and-vanilla-javascript/