From a2c204644bde47faa1738c621d2577330b46a5cb Mon Sep 17 00:00:00 2001 From: Grant Galitz Date: Sun, 19 Jun 2011 13:02:30 -0400 Subject: [PATCH] Adding the swfobject 2.2 library for internet explorer support (Fuck everything about the bugs in IE9). --- js/other/XAudioServer.js | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/js/other/XAudioServer.js b/js/other/XAudioServer.js index 621cf44..8f46ba8 100644 --- a/js/other/XAudioServer.js +++ b/js/other/XAudioServer.js @@ -237,22 +237,36 @@ XAudioServer.prototype.initializeAudio = function () { this.audioType = 3; return; } + var thisObj = this; + this.audioHandle = {}; + var mainContainerNode = document.createElement("div"); + mainContainerNode.setAttribute("style", "position: fixed; bottom: 0px; right: 0px; margin: 0px; padding: 0px; border: none; width: 8px; height: 8px; overflow: hidden; z-index: -1000; "); var containerNode = document.createElement("div"); - containerNode.setAttribute("style", "position: fixed; top: 0px; left: 0px; width: 0px; height: 0px; overflow: hidden; z-index: -1000; visibility: hidden;"); - objectNode = document.createElement("object"); - objectNode.setAttribute("style", "position: relative; height: 8px; width: 8px; overflow: hidden;"); - objectNode.setAttribute("type", "application/x-shockwave-flash"); - objectNode.setAttribute("data", "XAudioJS.swf"); - objectNode.setAttribute("id", "XAudioJS"); - var param = document.createElement("param"); - param.setAttribute("name", "allowscriptaccess"); - param.setAttribute("value", "always"); - objectNode.appendChild(param); - containerNode.appendChild(objectNode); - document.getElementsByTagName("body")[0].appendChild(containerNode); + containerNode.setAttribute("style", "position: static; border: none; width: 0px; height: 0px; visibility: hidden; margin: 0px; padding: 0px;"); + containerNode.setAttribute("id", "XAudioJS"); + mainContainerNode.appendChild(containerNode); + document.getElementsByTagName("body")[0].appendChild(mainContainerNode); + swfobject.embedSWF( + "XAudioJS.swf", + "XAudioJS", + "8", + "8", + "9.0.0", + "", + {}, + {"allowscriptaccess":"always"}, + {"style":"position: static; visibility: hidden; margin: 0px; padding: 0px; border: none"}, + function (event) { + if (event.success) { + thisObj.audioHandle = event.ref; + } + else { + alert("Your browser does not like the Adobe Flash audio fallback. :("); + } + } + ); this.audioType = 3; this.flashInitialized = false; - this.audioHandle = objectNode; } catch (error) { this.audioHandle = new AudioThread(this.audioChannels, XAudioJSSampleRate, 16, false);