HTML5 Audio, Web Audio API, CORS, and Firefox

I tried to get this to work correctly, so now with no luck.

I created a custom audio player that accesses MP3s on an Amazon S3 server. The audio player has customizable controls included with Javascript, and an audio visualizer created by the web audio API.

Now the problem I am facing is this: work fine in Chrome. Safari says live that it cannot launch the web audio API, but the sound will still play. In Firefox, it all ends. Click play ... nothing. I thought this was a CORS problem, so we set the correct headers on the server and still nothing. BUT ... if I deactivate the Web Audio API, then I can make the player play just fine.

http://jsfiddle.net/murphy1976/yqqf7uL1/1/

Here is my jFiddle. I separated the Audio Player Script controls from the Visualizer Script with comments so you can see how it will work in Firefox and how it will NOT work in Firefox.

I read somewhere that this problem that I encountered may be a bug with Firefox. I just want to make sure that I can stop beating my skull.

Can I call CORS here:

<source crossorigin="anonymous" src="audioFiles/35022797.mp3" id="srcMP3" type="audio/mp3">
+4
source share
2 answers

A policy of the same origin says that scripts running on some source cannot read resources from another source. (Origin is a domain, plus a schema and port, for example http://foo.example.com:80.)

, . , -. <img>: example.com other.com, script on example.com . ; .

API - . , . -, script . - script (, ), . , , , .

, Chrome cross-origin , .

, - HTTP CORS Access-Control-Allow-Origin: *. Firefox, . Firefox , .

+16

, Firefox createMediaElementSource :

https://bugzilla.mozilla.org/show_bug.cgi?id=937718

0

All Articles